diff options
author | fmalita <fmalita@chromium.org> | 2015-07-27 10:27:28 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-27 10:27:29 -0700 |
commit | 9a5d1ab54d52a912bb3ac9f74ee01bba079639e5 (patch) | |
tree | 8a3483083be8e674d7e0e14ccc7fd22de47724e3 /tests | |
parent | 1c63436f39796d3ed5f27f54d07f6cc120006b94 (diff) |
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
Diffstat (limited to 'tests')
-rw-r--r-- | tests/DeferredCanvasTest.cpp | 3 | ||||
-rw-r--r-- | tests/SkImageTest.cpp | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/tests/DeferredCanvasTest.cpp b/tests/DeferredCanvasTest.cpp index a34f5bcedc..0aa0af68c1 100644 --- a/tests/DeferredCanvasTest.cpp +++ b/tests/DeferredCanvasTest.cpp @@ -64,7 +64,8 @@ public: } SkImage* onNewImageSnapshot(Budgeted) override { - return SkNewImageFromRasterBitmap(fBitmap, true, &this->props()); + return SkNewImageFromRasterBitmap(fBitmap, true, &this->props(), + kUnlocked_SharedPixelRefMode); } void onCopyOnWrite(ContentChangeMode mode) override { diff --git a/tests/SkImageTest.cpp b/tests/SkImageTest.cpp index 2f23b3f661..508982cea6 100644 --- a/tests/SkImageTest.cpp +++ b/tests/SkImageTest.cpp @@ -26,7 +26,8 @@ DEF_TEST(SkImageFromBitmap_extractSubset, reporter) { canvas.drawIRect(r, p); SkBitmap dstBitmap; srcBitmap.extractSubset(&dstBitmap, r); - image.reset(SkNewImageFromRasterBitmap(dstBitmap, true, NULL)); + image.reset(SkNewImageFromRasterBitmap(dstBitmap, true, NULL, + kUnlocked_SharedPixelRefMode)); } SkBitmap tgt; |