Index: src/image/SkSurface_Raster.cpp |
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp |
index d66aed213aeff1f05f1f8ae1a28c09d286635707..d59aef7c753228e885be6cc0516b530246b655eb 100644 |
--- a/src/image/SkSurface_Raster.cpp |
+++ b/src/image/SkSurface_Raster.cpp |
@@ -118,7 +118,10 @@ void SkSurface_Raster::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, |
} |
SkImage* SkSurface_Raster::onNewImageSnapshot(Budgeted) { |
- return SkNewImageFromRasterBitmap(fBitmap, fWeOwnThePixels, &this->props()); |
+ // Our pixels are in memory, so read access on the snapshot SkImage could be cheap. |
+ // Lock the shared pixel ref to ensure peekPixels() is usable. |
+ return SkNewImageFromRasterBitmap(fBitmap, fWeOwnThePixels, &this->props(), |
+ kLocked_SharedPixelRefMode); |
} |
void SkSurface_Raster::onCopyOnWrite(ContentChangeMode mode) { |