aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2014-10-07 05:19:24 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-10-07 05:19:24 -0700
commitb9ab5631703c258f1aae7a3ca1bb4b6596b5b42c (patch)
treefbd252023e73b36f7dd5085025abf4b2cc7d1a58
parentb1b2085569dd0587619c2c7c8a7c4b1ce6c59761 (diff)
Don't readback and reupload texture-backed bitmaps
-rw-r--r--src/gpu/SkGr.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index e81abdbae4..262d339b6c 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -372,7 +372,10 @@ bool GrIsBitmapInCache(const GrContext* ctx,
GrTexture* GrLockAndRefCachedBitmapTexture(GrContext* ctx,
const SkBitmap& bitmap,
const GrTextureParams* params) {
- GrTexture* result = NULL;
+ GrTexture* result = bitmap.getTexture();
+ if (result) {
+ return SkRef(result);
+ }
bool cache = !bitmap.isVolatile();
@@ -400,7 +403,9 @@ GrTexture* GrLockAndRefCachedBitmapTexture(GrContext* ctx,
void GrUnlockAndUnrefCachedBitmapTexture(GrTexture* texture) {
SkASSERT(texture->getContext());
- texture->getContext()->unlockScratchTexture(texture);
+ if (texture->getCacheEntry()) {
+ texture->getContext()->unlockScratchTexture(texture);
+ }
texture->unref();
}