Index: src/image/SkImagePriv.h |
diff --git a/src/image/SkImagePriv.h b/src/image/SkImagePriv.h |
index afaf3f173619ef376afaada9946345dcf4d1f1d8..876c4279b6ebaca031ad190a82b59dc41421f8f7 100644 |
--- a/src/image/SkImagePriv.h |
+++ b/src/image/SkImagePriv.h |
@@ -19,9 +19,15 @@ extern SkImage* SkNewImageFromPixelRef(const SkImageInfo&, SkPixelRef*, |
/** |
* Examines the bitmap to decide if it can share the existing pixelRef, or |
- * if it needs to make a deep-copy of the pixels. The bitmap's pixelref will |
- * be shared if either the bitmap is marked as immutable, or canSharePixelRef |
- * is true. |
+ * if it needs to make a deep-copy of the pixels. |
+ * |
+ * The bitmap's pixelref will be shared if either the bitmap is marked as |
+ * immutable, or forceSharePixelRef is true. Shared pixel refs are also |
+ * locked when kLocked_SharedPixelRefMode is specified. |
+ * |
+ * Passing kLocked_SharedPixelRefMode allows the image's peekPixels() method |
+ * to succeed, but it will force any lazy decodes/generators to execute if |
+ * they exist on the pixelref. |
* |
* It is illegal to call this with a texture-backed bitmap. |
* |
@@ -29,8 +35,12 @@ extern SkImage* SkNewImageFromPixelRef(const SkImageInfo&, SkPixelRef*, |
* SkImageInfo, or the bitmap's pixels cannot be accessed, this will return |
* NULL. |
*/ |
+enum SharedPixelRefMode { |
+ kLocked_SharedPixelRefMode, |
+ kUnlocked_SharedPixelRefMode |
+}; |
extern SkImage* SkNewImageFromRasterBitmap(const SkBitmap&, bool forceSharePixelRef, |
- const SkSurfaceProps*); |
+ const SkSurfaceProps*, SharedPixelRefMode); |
static inline size_t SkImageMinRowBytes(const SkImageInfo& info) { |
size_t minRB = info.minRowBytes(); |