| Index: include/core/SkImageGenerator.h
|
| diff --git a/include/core/SkImageGenerator.h b/include/core/SkImageGenerator.h
|
| index 2967974c7845cb95cfb6c5b7f2e3b0815fde9f88..92314d3358a660c344e6b7339cb6a200ff3dc019 100644
|
| --- a/include/core/SkImageGenerator.h
|
| +++ b/include/core/SkImageGenerator.h
|
| @@ -11,6 +11,8 @@
|
| #include "SkColor.h"
|
| #include "SkImageInfo.h"
|
|
|
| +//#define SK_SUPPORT_LEGACY_IMAGEGENERATOR_YUV_API
|
| +
|
| class SkBitmap;
|
| class SkData;
|
| class SkImageGenerator;
|
| @@ -107,6 +109,7 @@ public:
|
| */
|
| bool getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes);
|
|
|
| +#ifdef SK_SUPPORT_LEGACY_IMAGEGENERATOR_YUV_API
|
| /**
|
| * If planes or rowBytes is NULL or if any entry in planes is NULL or if any entry in rowBytes
|
| * is 0, this imagegenerator should output the sizes and return true if it can efficiently
|
| @@ -120,6 +123,36 @@ public:
|
| */
|
| bool getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
|
| SkYUVColorSpace* colorSpace);
|
| +#endif
|
| +
|
| + /**
|
| + * If this generator supports returning planar YUV data, return true, and return
|
| + * the logicalSizes (if not NULL) and the optimalAllocationSizes (if not NULL), where each
|
| + * array represents [0]=Y, [1]=U, [2]=V. Each Size is a width/height in pixels for its plane.
|
| + *
|
| + * The optimalAllocationSizes may be the same as the logicalSizes, but they may also be larger
|
| + * if that will aid the generator (for performance).
|
| + *
|
| + * If this returns false, the value of the (optional) sizes parameters is undefined.
|
| + */
|
| + bool queryYUV8(SkISize logicalSizes[3], SkISize optimalAllocationSizes[3]);
|
| +
|
| + /**
|
| + * If this generator supports returning planar YUV data, and can fulfill the requested
|
| + * sizes for each plane, return true and write the YUV data into the planes.
|
| + *
|
| + * Calling queryYUV8() will return both the logical sizes (W/H) and the optimal-allocation
|
| + * sizes for the 3 planes. For getYUV8(), it is legal to pass the logical sizes
|
| + * (though smaller than those will return false). However, this may
|
| + * (depending on the implementation) be slower than passing in the optimal-allocation sizes
|
| + * (or larger). The extra space may allow the implementation to run faster at the cost of
|
| + * slightly more ram being allocated. There should be no performance penalty for the
|
| + * allocationSizes to larger than the values in optimalAllocationSizes, as they are just the
|
| + * minimum sizes for best performance.
|
| + *
|
| + * If colorSpace is not NULL, return the corresponding colorSpace for the YUV data.
|
| + */
|
| + bool getYUV8(const SkISize allocationSizes[3], void* planes[3], SkYUVColorSpace* colorSpace);
|
|
|
| /**
|
| * If the default image decoder system can interpret the specified (encoded) data, then
|
| @@ -134,9 +167,17 @@ protected:
|
| virtual bool onGetPixels(const SkImageInfo& info,
|
| void* pixels, size_t rowBytes,
|
| SkPMColor ctable[], int* ctableCount);
|
| + // logicalSizes and optimalAllocationSizes will be non-null
|
| + virtual bool onQueryYUV8(SkISize logicalSizes[3], SkISize optimalAllocationSizes[3]);
|
| + // logicalSizes and optimalAllocationSizes and planes will be non-null.
|
| + // colorSpace may still be null.
|
| + virtual bool onGetYUV8(const SkISize allocationSizes[3], void* planes[3],
|
| + SkYUVColorSpace* colorSpace);
|
| +#ifdef SK_SUPPORT_LEGACY_IMAGEGENERATOR_YUV_API
|
| 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);
|
| +#endif
|
| };
|
|
|
| #endif // SkImageGenerator_DEFINED
|
|
|