aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkPixelRef.h
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-06 14:26:02 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-06 14:26:02 +0000
commiteb776128f5024cc50886634382731220f7424a9a (patch)
tree177b8af80b0ff24ed5be11f4cfedb28a2aa18d69 /include/core/SkPixelRef.h
parent34cd70a5810b3cf37b44de1ce080a911a8b342c8 (diff)
add query to pixelref for its encoded data (if it has any)
Review URL: https://codereview.appspot.com/6891047 git-svn-id: http://skia.googlecode.com/svn/trunk@6689 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkPixelRef.h')
-rw-r--r--include/core/SkPixelRef.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h
index 9222b29e43..74d32ac9ac 100644
--- a/include/core/SkPixelRef.h
+++ b/include/core/SkPixelRef.h
@@ -16,6 +16,7 @@
#include "SkFlattenable.h"
class SkColorTable;
+class SkData;
struct SkIRect;
class SkMutex;
@@ -113,6 +114,18 @@ public:
*/
void setURI(const SkString& uri) { fURI = uri; }
+ /**
+ * If the pixelRef has an encoded (i.e. compressed) representation,
+ * return a ref to its data. If the pixelRef
+ * is uncompressed or otherwise does not have this form, return NULL.
+ *
+ * If non-null is returned, the caller is responsible for calling unref()
+ * on the data when it is finished.
+ */
+ SkData* refEncodedData() {
+ return this->onRefEncodedData();
+ }
+
/** Are we really wrapping a texture instead of a bitmap?
*/
virtual SkGpuTexture* getTexture() { return NULL; }
@@ -163,6 +176,9 @@ protected:
*/
virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subsetOrNull);
+ // default impl returns NULL.
+ virtual SkData* onRefEncodedData();
+
/** Return the mutex associated with this pixelref. This value is assigned
in the constructor, and cannot change during the lifetime of the object.
*/