Index: include/core/SkPixelRef.h |
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h |
index 0487e426109a2e84381e84aff4638ec0c6eccfb3..395fb93607b90a25d2f01bf21ee9b9ceb105b6d2 100644 |
--- a/include/core/SkPixelRef.h |
+++ b/include/core/SkPixelRef.h |
@@ -141,6 +141,21 @@ public: |
return this->onRefEncodedData(); |
} |
+ /** |
+ * Return a decoded instance of this pixelRef in bitmap. If this cannot be |
+ * done, return false and ignore bitmap. |
+ * pow2 is the requeste power-of-two downscale that the caller needs. This |
+ * can be ignored, and the "original" size can be returned, but if the |
+ * underlying codec can efficiently return a smaller size, that should be |
+ * done. |
+ * If this returns true, then bitmap must be "locked" and point to the |
+ * pixels for this pixelref. |
+ */ |
+ bool decodeInto(int pow2, SkBitmap* bitmap) { |
+ SkASSERT(pow2 >= 0); |
+ return this->onDecodeInto(pow2, bitmap); |
+ } |
+ |
/** Are we really wrapping a texture instead of a bitmap? |
*/ |
virtual GrTexture* getTexture() { return NULL; } |
@@ -190,6 +205,8 @@ protected: |
/** Default impl returns true */ |
virtual bool onLockPixelsAreWritable() const; |
+ virtual bool onDecodeInto(int pow2, SkBitmap* bitmap); |
+ |
/** |
* For pixelrefs that don't have access to their raw pixels, they may be |
* able to make a copy of them (e.g. if the pixels are on the GPU). |