diff options
author | 2011-07-07 13:42:37 +0000 | |
---|---|---|
committer | 2011-07-07 13:42:37 +0000 | |
commit | 9c49bc3e643c435677727c1c0904c4a7cb7a6907 (patch) | |
tree | 20d6cb41a7367fddcdd4a8c8c958934fcb2c7955 /src/core/SkDevice.cpp | |
parent | 63e5e34c4ef180ea0f2d7b2f1343d92063c7cc10 (diff) |
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
Diffstat (limited to 'src/core/SkDevice.cpp')
-rw-r--r-- | src/core/SkDevice.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
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) { |