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

Unified Diff: src/image/SkImagePriv.h

Issue 1256993002: Make peekPixels() usable with raster surface snapshots (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: review comments Created 5 years, 5 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 | « src/image/SkImage.cpp ('k') | src/image/SkImage_Raster.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « src/image/SkImage.cpp ('k') | src/image/SkImage_Raster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698