Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: include/core/SkImageGenerator.h

Issue 304443003: add colortable support to imagegenerator (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix spelling Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/skia_for_chromium_defines.gypi ('k') | src/images/SkDecodingImageGenerator.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkImageGenerator.h
diff --git a/include/core/SkImageGenerator.h b/include/core/SkImageGenerator.h
index f399ab538e9ea05d125ab1b21ec387640d69ffc3..21ebcbb3f26ba835b16cadfdc28874cf7731bb80 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;
@@ -47,6 +48,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.
@@ -54,7 +62,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
@@ -65,7 +73,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
@@ -83,12 +91,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
« no previous file with comments | « gyp/skia_for_chromium_defines.gypi ('k') | src/images/SkDecodingImageGenerator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698