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

Unified Diff: include/core/SkImageGenerator.h

Issue 1556333004: take gr-context parameter to refEncoded, indicating a desire for only gpu-specific formats (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update dox Created 4 years, 11 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 | « no previous file | src/core/SkImageCacherator.h » ('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 66db5e4884275257947d18a5e2f27b3c17dbd483..86e3053a06928b3d9f6dd4eecf576464dc1f8caf 100644
--- a/include/core/SkImageGenerator.h
+++ b/include/core/SkImageGenerator.h
@@ -22,6 +22,12 @@ class SkMatrix;
class SkPaint;
class SkPicture;
+#ifdef SK_SUPPORT_LEGACY_REFENCODEDDATA_NOCTX
+ #define SK_REFENCODEDDATA_CTXPARAM
+#else
+ #define SK_REFENCODEDDATA_CTXPARAM GrContext* ctx
+#endif
+
/**
* Takes ownership of SkImageGenerator. If this method fails for
* whatever reason, it will return false and immediatetely delete
@@ -64,12 +70,20 @@ public:
/**
* Return a ref to the encoded (i.e. compressed) representation,
- * of this data.
+ * of this data. If the GrContext is non-null, then the caller is only interested in
+ * gpu-specific formats, so the impl may return null even if they have encoded data,
+ * assuming they know it is not suitable for the gpu.
*
* If non-NULL is returned, the caller is responsible for calling
* unref() on the data when it is finished.
*/
- SkData* refEncodedData() { return this->onRefEncodedData(); }
+ SkData* refEncodedData(GrContext* ctx = nullptr) {
+#ifdef SK_SUPPORT_LEGACY_REFENCODEDDATA_NOCTX
+ return this->onRefEncodedData();
+#else
+ return this->onRefEncodedData(ctx);
+#endif
+ }
/**
* Return the ImageInfo associated with this generator.
@@ -230,7 +244,7 @@ public:
protected:
SkImageGenerator(const SkImageInfo& info);
- virtual SkData* onRefEncodedData();
+ virtual SkData* onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM);
virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
SkPMColor ctable[], int* ctableCount);
« no previous file with comments | « no previous file | src/core/SkImageCacherator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698