diff options
author | 2013-05-07 19:17:02 +0000 | |
---|---|---|
committer | 2013-05-07 19:17:02 +0000 | |
commit | 7df1bb76d376b1869e4db9812e1f1cecc3ad7e1d (patch) | |
tree | 1ad397edbe08939085e17b813ffafeecacab6697 /src/gpu | |
parent | a5e55925ea03e76885804bda77408a1d6f04c335 (diff) |
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
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 6 | ||||
-rw-r--r-- | src/gpu/SkGr.cpp | 6 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 837ff8c245..22f01f92e8 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -1367,12 +1367,6 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap, SkASSERT(bitmap.width() <= fContext->getMaxTextureSize() && bitmap.height() <= fContext->getMaxTextureSize()); - SkAutoLockPixels alp(bitmap, !bitmap.getTexture()); - if (!bitmap.getTexture() && !bitmap.readyToDraw()) { - SkDebugf("nothing to draw\n"); - return; - } - GrTexture* texture; SkAutoCachedTexture act(this, bitmap, ¶ms, &texture); if (NULL == texture) { diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index d76a34a1cf..1a330344a7 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 @@ static GrTexture* sk_gr_create_bitmap_texture(GrContext* ctx, } } + 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; |