| 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 |
| 11 #include "SkColor.h" | 11 #include "SkColor.h" |
| 12 #include "SkImageInfo.h" | 12 #include "SkImageInfo.h" |
| 13 | 13 |
| 14 class SkBitmap; | 14 class SkBitmap; |
| 15 class SkData; | 15 class SkData; |
| 16 class SkImageGenerator; | 16 class SkImageGenerator; |
| 17 | 17 |
| 18 //#define SK_SUPPORT_LEGACY_IMAGE_GENERATOR_RETURN | 18 //#define SK_SUPPORT_LEGACY_GET_PIXELS_ENUM |
| 19 |
| 20 #ifdef SK_SUPPORT_LEGACY_GET_PIXELS_ENUM |
| 21 #define onGetPixelsEnum onGetPixels |
| 22 #endif |
| 19 | 23 |
| 20 /** | 24 /** |
| 21 * Takes ownership of SkImageGenerator. If this method fails for | 25 * Takes ownership of SkImageGenerator. If this method fails for |
| 22 * whatever reason, it will return false and immediatetely delete | 26 * whatever reason, it will return false and immediatetely delete |
| 23 * the generator. If it succeeds, it will modify destination | 27 * the generator. If it succeeds, it will modify destination |
| 24 * bitmap. | 28 * bitmap. |
| 25 * | 29 * |
| 26 * If generator is NULL, will safely return false. | 30 * If generator is NULL, will safely return false. |
| 27 * | 31 * |
| 28 * If this fails or when the SkDiscardablePixelRef that is | 32 * If this fails or when the SkDiscardablePixelRef that is |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 /** | 176 /** |
| 173 * If the default image decoder system can interpret the specified (encoded
) data, then | 177 * If the default image decoder system can interpret the specified (encoded
) data, then |
| 174 * this returns a new ImageGenerator for it. Otherwise this returns NULL. E
ither way | 178 * this returns a new ImageGenerator for it. Otherwise this returns NULL. E
ither way |
| 175 * the caller is still responsible for managing their ownership of the data
. | 179 * the caller is still responsible for managing their ownership of the data
. |
| 176 */ | 180 */ |
| 177 static SkImageGenerator* NewFromData(SkData*); | 181 static SkImageGenerator* NewFromData(SkData*); |
| 178 | 182 |
| 179 protected: | 183 protected: |
| 180 virtual SkData* onRefEncodedData(); | 184 virtual SkData* onRefEncodedData(); |
| 181 virtual bool onGetInfo(SkImageInfo* info); | 185 virtual bool onGetInfo(SkImageInfo* info); |
| 182 #ifdef SK_SUPPORT_LEGACY_IMAGE_GENERATOR_RETURN | 186 virtual Result onGetPixels(const SkImageInfo& info, |
| 183 virtual bool onGetPixels(const SkImageInfo& info, | 187 void* pixels, size_t rowBytes, |
| 184 void* pixels, size_t rowBytes, | 188 SkPMColor ctable[], int* ctableCount); |
| 185 SkPMColor ctable[], int* ctableCount); | |
| 186 #endif | |
| 187 // TODO (scroggo): rename to onGetPixels. | |
| 188 virtual Result onGetPixelsEnum(const SkImageInfo& info, | |
| 189 void* pixels, size_t rowBytes, | |
| 190 SkPMColor ctable[], int* ctableCount); | |
| 191 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3]); | 189 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3]); |
| 192 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3], | 190 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3], |
| 193 SkYUVColorSpace* colorSpace); | 191 SkYUVColorSpace* colorSpace); |
| 194 }; | 192 }; |
| 195 | 193 |
| 196 #endif // SkImageGenerator_DEFINED | 194 #endif // SkImageGenerator_DEFINED |
| OLD | NEW |