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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 133 |
134 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 134 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
135 | 135 |
136 #include "SkGraphics.h" | 136 #include "SkGraphics.h" |
137 | 137 |
138 static SkGraphics::ImageGeneratorFromEncodedFactory gImageGeneratorFromEncodedFa
ctory; | 138 static SkGraphics::ImageGeneratorFromEncodedFactory gFactory; |
139 | 139 |
140 SkGraphics::ImageGeneratorFromEncodedFactory SkGraphics::GetImageGeneratorFromEn
codedFactory() { | 140 SkGraphics::ImageGeneratorFromEncodedFactory |
141 return gImageGeneratorFromEncodedFactory; | 141 SkGraphics::SetImageGeneratorFromEncodedFactory(ImageGeneratorFromEncodedFactory
factory) |
142 } | 142 { |
143 | 143 ImageGeneratorFromEncodedFactory prev = gFactory; |
144 void SkGraphics::SetImageGeneratorFromEncodedFactory(ImageGeneratorFromEncodedFa
ctory factory) { | 144 gFactory = factory; |
145 gImageGeneratorFromEncodedFactory = factory; | 145 return prev; |
146 } | 146 } |
147 | 147 |
148 SkImageGenerator* SkImageGenerator::NewFromEncoded(SkData* data) { | 148 SkImageGenerator* SkImageGenerator::NewFromEncoded(SkData* data) { |
149 if (NULL == data) { | 149 if (NULL == data) { |
150 return NULL; | 150 return NULL; |
151 } | 151 } |
152 if (gImageGeneratorFromEncodedFactory) { | 152 if (gFactory) { |
153 if (SkImageGenerator* generator = gImageGeneratorFromEncodedFactory(data
)) { | 153 if (SkImageGenerator* generator = gFactory(data)) { |
154 return generator; | 154 return generator; |
155 } | 155 } |
156 } | 156 } |
157 return SkImageGenerator::NewFromEncodedImpl(data); | 157 return SkImageGenerator::NewFromEncodedImpl(data); |
158 } | 158 } |
OLD | NEW |