| Index: include/core/SkImageGenerator.h
|
| diff --git a/include/core/SkImageGenerator.h b/include/core/SkImageGenerator.h
|
| index 76e856b387c95109eb8e0cb70d72ca5758df6f82..86cd7f0c1068ccf199c71ed9e8fdb2cbe5fe7bc5 100644
|
| --- a/include/core/SkImageGenerator.h
|
| +++ b/include/core/SkImageGenerator.h
|
| @@ -9,6 +9,7 @@
|
| #define SkImageGenerator_DEFINED
|
|
|
| #include "SkImageInfo.h"
|
| +#include "SkColor.h"
|
|
|
| class SkBitmap;
|
| class SkData;
|
| @@ -53,6 +54,13 @@ public:
|
| */
|
| virtual ~SkImageGenerator() { }
|
|
|
| +#ifdef SK_SUPPORT_LEGACY_IMAGEGENERATORAPI
|
| + virtual bool refEncodedData() { return this->onRefEncodedData(); }
|
| + virtual bool getInfo(SkImageInfo* info) { return this->onGetInfo(info); }
|
| + virtual bool getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes) {
|
| + return this->onGetPixels(info, pixels, rowBytes, NULL, NULL);
|
| + }
|
| +#else
|
| /**
|
| * Return a ref to the encoded (i.e. compressed) representation,
|
| * of this data.
|
| @@ -60,7 +68,7 @@ public:
|
| * If non-NULL is returned, the caller is responsible for calling
|
| * unref() on the data when it is finished.
|
| */
|
| - virtual SkData* refEncodedData() { return NULL; }
|
| + SkData* refEncodedData() { return this->onRefEncodedData(); }
|
|
|
| /**
|
| * Return some information about the image, allowing the owner of
|
| @@ -71,7 +79,7 @@ public:
|
| *
|
| * @return false if anything goes wrong.
|
| */
|
| - virtual bool getInfo(SkImageInfo* info) = 0;
|
| + bool getInfo(SkImageInfo* info);
|
|
|
| /**
|
| * Decode into the given pixels, a block of memory of size at
|
| @@ -89,12 +97,31 @@ public:
|
| * different output-configs, which the implementation can
|
| * decide to support or not.
|
| *
|
| + * If info is kIndex8_SkColorType, then the caller must provide storage for up to 256
|
| + * SkPMColor values in ctable. On success the generator must copy N colors into that storage,
|
| + * (where N is the logical number of table entries) and set ctableCount to N.
|
| + *
|
| + * If info is not kIndex8_SkColorType, then the last two parameters may be NULL. If ctableCount
|
| + * is not null, it will be set to 0.
|
| + *
|
| * @return false if anything goes wrong or if the image info is
|
| * unsupported.
|
| */
|
| - virtual bool getPixels(const SkImageInfo& info,
|
| - void* pixels,
|
| - size_t rowBytes) = 0;
|
| + bool getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
|
| + SkPMColor ctable[], int* ctableCount);
|
| +
|
| + /**
|
| + * Simplified version of getPixels() that asserts that info is NOT kIndex8_SkColorType.
|
| + */
|
| + bool getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes);
|
| +#endif
|
| +
|
| +protected:
|
| + virtual SkData* onRefEncodedData();
|
| + virtual bool onGetInfo(SkImageInfo* info);
|
| + virtual bool onGetPixels(const SkImageInfo& info,
|
| + void* pixels, size_t rowBytes,
|
| + SkPMColor ctable[], int* ctableCount);
|
| };
|
|
|
| #endif // SkImageGenerator_DEFINED
|
|
|