Make peekPixels() usable with raster surface snapshots

SkSurface_Raster snapshots do not lock their backing bitmaps when the
pixel ref is shared - they only lock on deep-copy.

But since for raster surfaces the pixels are always in memory, I think
it would be OK to also lock in the former case.

This allows for optimized (zero-copy) reads of raster surface snapshot
data.

R=reed@google.com

Review URL: https://codereview.chromium.org/1256993002
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index d66aed2..d59aef7 100644
--- a/src/image/SkSurface_Raster.cpp
+++ b/src/image/SkSurface_Raster.cpp
@@ -118,7 +118,10 @@
 }
 
 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) {