OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkImageGenerator.h" | 8 #include "SkImageGenerator.h" |
9 | 9 |
10 bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r
owBytes, | 10 bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r
owBytes, |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 size_t rb, const Options&
options, | 123 size_t rb, const Options&
options, |
124 SkPMColor* colors, int* c
olorCount) { | 124 SkPMColor* colors, int* c
olorCount) { |
125 return kUnimplemented; | 125 return kUnimplemented; |
126 } | 126 } |
127 #else | 127 #else |
128 bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb
, | 128 bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb
, |
129 SkPMColor* colors, int* colorCount) { | 129 SkPMColor* colors, int* colorCount) { |
130 return false; | 130 return false; |
131 } | 131 } |
132 #endif | 132 #endif |
| 133 |
| 134 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 135 |
| 136 #include "SkGraphics.h" |
| 137 |
| 138 static SkGraphics::ImageGeneratorFromEncodedFactory gImageGeneratorFromEncodedFa
ctory; |
| 139 |
| 140 SkGraphics::ImageGeneratorFromEncodedFactory SkGraphics::GetImageGeneratorFromEn
codedFactory() { |
| 141 return gImageGeneratorFromEncodedFactory; |
| 142 } |
| 143 |
| 144 void SkGraphics::SetImageGeneratorFromEncodedFactory(ImageGeneratorFromEncodedFa
ctory factory) { |
| 145 gImageGeneratorFromEncodedFactory = factory; |
| 146 } |
| 147 |
| 148 SkImageGenerator* SkImageGenerator::NewFromEncoded(SkData* data) { |
| 149 if (NULL == data) { |
| 150 return NULL; |
| 151 } |
| 152 if (gImageGeneratorFromEncodedFactory) { |
| 153 if (SkImageGenerator* generator = gImageGeneratorFromEncodedFactory(data
)) { |
| 154 return generator; |
| 155 } |
| 156 } |
| 157 return SkImageGenerator::NewFromEncodedImpl(data); |
| 158 } |
OLD | NEW |