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 |