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

Unified Diff: src/core/SkWriteBuffer.cpp

Issue 1074983003: add SkPixmap and external locking to bitmaps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 7 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
Index: src/core/SkWriteBuffer.cpp
diff --git a/src/core/SkWriteBuffer.cpp b/src/core/SkWriteBuffer.cpp
index 6048c9f5c2c3ea8717b0222c070f3bb1b063d002..d2eb8c5d8d234c7aaaf7b491b7e8a78d93c8628e 100644
--- a/src/core/SkWriteBuffer.cpp
+++ b/src/core/SkWriteBuffer.cpp
@@ -198,12 +198,13 @@ void SkWriteBuffer::writeBitmap(const SkBitmap& bitmap) {
}
// see if the caller wants to manually encode
- if (fPixelSerializer) {
+ SkAutoPixmapUnlock result;
+ if (fPixelSerializer && bitmap.requestLock(&result)) {
+ const SkPixmap& pmap = result.pixmap();
SkASSERT(NULL == fBitmapHeap);
- SkAutoLockPixels alp(bitmap);
- SkAutoDataUnref data(fPixelSerializer->encodePixels(bitmap.info(),
- bitmap.getPixels(),
- bitmap.rowBytes()));
+ SkAutoDataUnref data(fPixelSerializer->encodePixels(pmap.info(),
+ pmap.addr(),
+ pmap.rowBytes()));
if (data.get() != NULL) {
// if we have to "encode" the bitmap, then we assume there is no
// offset to share, since we are effectively creating a new pixelref
« src/core/SkPixelRef.cpp ('K') | « src/core/SkPixmap.cpp ('k') | tests/BitmapCopyTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698