From 9c49bc3e643c435677727c1c0904c4a7cb7a6907 Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Thu, 7 Jul 2011 13:42:37 +0000 Subject: Allow texture-backed bitmaps to perform a read-back when lockPixels is called. This means we have to be even more cautious about when we call lock, and we should always check getTexture() first if we can handle a texture directly, rather than forcing the read-back to get the bits. git-svn-id: http://skia.googlecode.com/svn/trunk@1815 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkDevice.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/core/SkDevice.cpp') diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp index 78b2dcc2ef..b4f5866981 100644 --- a/src/core/SkDevice.cpp +++ b/src/core/SkDevice.cpp @@ -57,11 +57,15 @@ SkMetaData& SkDevice::getMetaData() { } void SkDevice::lockPixels() { - fBitmap.lockPixels(); + if (fBitmap.lockPixelsAreWritable()) { + fBitmap.lockPixels(); + } } void SkDevice::unlockPixels() { - fBitmap.unlockPixels(); + if (fBitmap.lockPixelsAreWritable()) { + fBitmap.unlockPixels(); + } } const SkBitmap& SkDevice::accessBitmap(bool changePixels) { -- cgit v1.2.3