OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #ifndef SkImageGenerator_DEFINED | 8 #ifndef SkImageGenerator_DEFINED |
9 #define SkImageGenerator_DEFINED | 9 #define SkImageGenerator_DEFINED |
10 | 10 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 sk_throw(); | 244 sk_throw(); |
245 } | 245 } |
246 } | 246 } |
247 void generateBitmap(SkBitmap* bm, const SkImageInfo& info) { | 247 void generateBitmap(SkBitmap* bm, const SkImageInfo& info) { |
248 if (!this->tryGenerateBitmap(bm, &info, nullptr)) { | 248 if (!this->tryGenerateBitmap(bm, &info, nullptr)) { |
249 sk_throw(); | 249 sk_throw(); |
250 } | 250 } |
251 } | 251 } |
252 | 252 |
253 protected: | 253 protected: |
254 SkImageGenerator(const SkImageInfo& info); | 254 enum { |
| 255 kNeedNewImageUniqueID = 0 |
| 256 }; |
| 257 |
| 258 SkImageGenerator(const SkImageInfo& info, uint32_t uniqueId = kNeedNewImageU
niqueID); |
255 | 259 |
256 virtual SkData* onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM); | 260 virtual SkData* onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM); |
257 | 261 |
258 virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBy
tes, | 262 virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBy
tes, |
259 SkPMColor ctable[], int* ctableCount); | 263 SkPMColor ctable[], int* ctableCount); |
260 | 264 |
261 virtual bool onQueryYUV8(SkYUVSizeInfo*, SkYUVColorSpace*) const { | 265 virtual bool onQueryYUV8(SkYUVSizeInfo*, SkYUVColorSpace*) const { |
262 return false; | 266 return false; |
263 } | 267 } |
264 virtual bool onGetYUV8Planes(const SkYUVSizeInfo&, void*[3] /*planes*/) { | 268 virtual bool onGetYUV8Planes(const SkYUVSizeInfo&, void*[3] /*planes*/) { |
(...skipping 17 matching lines...) Expand all Loading... |
282 const SkImageInfo fInfo; | 286 const SkImageInfo fInfo; |
283 const uint32_t fUniqueID; | 287 const uint32_t fUniqueID; |
284 | 288 |
285 // This is our default impl, which may be different on different platforms. | 289 // This is our default impl, which may be different on different platforms. |
286 // It is called from NewFromEncoded() after it has checked for any runtime f
actory. | 290 // It is called from NewFromEncoded() after it has checked for any runtime f
actory. |
287 // The SkData will never be NULL, as that will have been checked by NewFromE
ncoded. | 291 // The SkData will never be NULL, as that will have been checked by NewFromE
ncoded. |
288 static SkImageGenerator* NewFromEncodedImpl(SkData*); | 292 static SkImageGenerator* NewFromEncodedImpl(SkData*); |
289 }; | 293 }; |
290 | 294 |
291 #endif // SkImageGenerator_DEFINED | 295 #endif // SkImageGenerator_DEFINED |
OLD | NEW |