SkGpuDevice: Delay locking bitmap pixels until we have a known texture cache miss.
Reivew URL: https://codereview.chromium.org/15035004/
git-svn-id: http://skia.googlecode.com/svn/trunk@9043 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index d76a34a..1a33034 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -24,7 +24,7 @@
static void build_compressed_data(void* buffer, const SkBitmap& bitmap) {
SkASSERT(SkBitmap::kIndex8_Config == bitmap.config());
- SkAutoLockPixels apl(bitmap);
+ SkAutoLockPixels alp(bitmap);
if (!bitmap.readyToDraw()) {
SkDEBUGFAIL("bitmap not ready to draw!");
return;
@@ -135,6 +135,10 @@
}
}
+ SkAutoLockPixels alp(*bitmap);
+ if (!bitmap->readyToDraw()) {
+ return NULL;
+ }
if (cache) {
// This texture is likely to be used again so leave it in the cache
GrCacheID cacheID;