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 #include "SkNextID.h" | 9 #include "SkNextID.h" |
10 | 10 |
11 SkImageGenerator::SkImageGenerator(const SkImageInfo& info) | 11 SkImageGenerator::SkImageGenerator(const SkImageInfo& info, uint32_t uniqueID) |
12 : fInfo(info) | 12 : fInfo(info) |
13 , fUniqueID(SkNextID::ImageID()) | 13 , fUniqueID(kNeedNewImageUniqueID == uniqueID ? SkNextID::ImageID() : unique
ID) |
14 {} | 14 {} |
15 | 15 |
16 bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r
owBytes, | 16 bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r
owBytes, |
17 SkPMColor ctable[], int* ctableCount) { | 17 SkPMColor ctable[], int* ctableCount) { |
18 if (kUnknown_SkColorType == info.colorType()) { | 18 if (kUnknown_SkColorType == info.colorType()) { |
19 return false; | 19 return false; |
20 } | 20 } |
21 if (nullptr == pixels) { | 21 if (nullptr == pixels) { |
22 return false; | 22 return false; |
23 } | 23 } |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 if (nullptr == data) { | 210 if (nullptr == data) { |
211 return nullptr; | 211 return nullptr; |
212 } | 212 } |
213 if (gFactory) { | 213 if (gFactory) { |
214 if (SkImageGenerator* generator = gFactory(data)) { | 214 if (SkImageGenerator* generator = gFactory(data)) { |
215 return generator; | 215 return generator; |
216 } | 216 } |
217 } | 217 } |
218 return SkImageGenerator::NewFromEncodedImpl(data); | 218 return SkImageGenerator::NewFromEncodedImpl(data); |
219 } | 219 } |
OLD | NEW |