Chromium Code Reviews| Index: include/core/SkImageGenerator.h |
| diff --git a/include/core/SkImageGenerator.h b/include/core/SkImageGenerator.h |
| index 5de9d3d85ace1d64a1cf2b7a3e3c1b412b6a2b68..a5440bd3b4d88011bb70dee991a28c2c1c61771c 100644 |
| --- a/include/core/SkImageGenerator.h |
| +++ b/include/core/SkImageGenerator.h |
| @@ -15,6 +15,8 @@ class SkBitmap; |
| class SkData; |
| class SkImageGenerator; |
| +//#define SK_SUPPORT_LEGACY_OPTIONLESS_GET_PIXELS |
|
djsollen
2015/03/06 20:41:56
remove this
scroggo
2015/03/06 20:54:25
I don't think we have an official position, but ty
|
| + |
| /** |
| * Takes ownership of SkImageGenerator. If this method fails for |
| * whatever reason, it will return false and immediatetely delete |
| @@ -117,6 +119,34 @@ public: |
| }; |
| /** |
| + * Whether or not the memory passed to getPixels is zero initialized. |
| + */ |
| + enum ZeroInitialized { |
| + /** |
| + * The memory passed to getPixels is zero initialized. The SkCodec |
| + * may take advantage of this by skipping writing zeroes. |
| + */ |
| + kYes_ZeroInitialized, |
| + /** |
| + * The memory passed to getPixels has not been initialized to zero, |
| + * so the SkCodec must write all zeroes to memory. |
| + * |
| + * This is the default. It will be used if no Options struct is used. |
| + */ |
| + kNo_ZeroInitialized, |
| + }; |
| + |
| + /** |
| + * Additional options to pass to getPixels. |
| + */ |
| + struct Options { |
| + Options() |
| + : fZeroInitialized(kNo_ZeroInitialized) {} |
| + |
| + ZeroInitialized fZeroInitialized; |
|
djsollen
2015/03/06 20:41:57
I could go either way, but why not bool fZeroIniti
scroggo
2015/03/06 20:54:25
I'm fine with adding Memory to the name.
djsollen
2015/03/06 21:14:48
The API as it stands is fine with me.
|
| + }; |
| + |
| + /** |
| * Decode into the given pixels, a block of memory of size at |
| * least (info.fHeight - 1) * rowBytes + (info.fWidth * |
| * bytesPerPixel) |
| @@ -145,11 +175,12 @@ public: |
| * |
| * @return Result kSuccess, or another value explaining the type of failure. |
| */ |
| - Result getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, |
| + Result getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, const Options*, |
| SkPMColor ctable[], int* ctableCount); |
| /** |
| - * Simplified version of getPixels() that asserts that info is NOT kIndex8_SkColorType. |
| + * Simplified version of getPixels() that asserts that info is NOT kIndex8_SkColorType and |
| + * uses the default Options. |
| */ |
| Result getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes); |
| @@ -177,9 +208,14 @@ public: |
| protected: |
| virtual SkData* onRefEncodedData(); |
| virtual bool onGetInfo(SkImageInfo* info); |
| +#ifdef SK_SUPPORT_LEGACY_OPTIONLESS_GET_PIXELS |
| virtual Result onGetPixels(const SkImageInfo& info, |
| void* pixels, size_t rowBytes, |
| SkPMColor ctable[], int* ctableCount); |
| +#endif |
| + virtual Result onGetPixels(const SkImageInfo& info, |
| + void* pixels, size_t rowBytes, const Options&, |
| + SkPMColor ctable[], int* ctableCount); |
| virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3]); |
| virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], |
| SkYUVColorSpace* colorSpace); |