Index: include/core/SkPixelRef.h |
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h |
index d90e58719bb0b87f5bd3b5ce9b0dc4c90e056259..4c564e40c2b741b713e1d9a80c4fe5eb5cf78e56 100644 |
--- a/include/core/SkPixelRef.h |
+++ b/include/core/SkPixelRef.h |
@@ -257,6 +257,16 @@ protected: |
// default impl returns NULL. |
virtual SkData* onRefEncodedData(); |
+ /** |
+ * Returns the size (in bytes) of the internally allocated memory. |
+ * This should be implemented in all serializable SkPixelRef derived classes. |
+ * SkBitmap::fPixelRefOffset + SkBitmap::getSafeSize() should never overflow this value, |
+ * otherwise the rendering code may attempt to read memory out of bounds. |
+ * |
+ * @return default impl returns 0. |
+ */ |
+ virtual size_t getAllocatedSizeInBytes() const; |
+ |
/** Return the mutex associated with this pixelref. This value is assigned |
in the constructor, and cannot change during the lifetime of the object. |
*/ |