Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Unified Diff: src/core/SkBitmapProcShader.cpp

Issue 262803005: SkBitmapProcShader: if the bitmap already has a texture, just use it. Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapProcShader.cpp
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
index 44bdc6d348e7f3af6505bceb87f3f38a22812c8b..b9b8fd49e697e1522cb0ca47f20f1b6b32bcdd1c 100644
--- a/src/core/SkBitmapProcShader.cpp
+++ b/src/core/SkBitmapProcShader.cpp
@@ -476,7 +476,13 @@ GrEffectRef* SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint&
}
GrTextureParams params(tm, textureFilterMode);
- GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, fRawBitmap, &params);
+ GrTexture* texture = fRawBitmap.getTexture();
+ bool didLockTexture = false;
+
+ if (!texture) {
+ texture = GrLockAndRefCachedBitmapTexture(context, fRawBitmap, &params);
+ didLockTexture = true;
+ }
if (NULL == texture) {
SkErrorInternals::SetError( kInternalError_SkError,
@@ -490,7 +496,9 @@ GrEffectRef* SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint&
} else {
effect = GrSimpleTextureEffect::Create(texture, matrix, params);
}
- GrUnlockAndUnrefCachedBitmapTexture(texture);
+ if (didLockTexture) {
+ GrUnlockAndUnrefCachedBitmapTexture(texture);
+ }
return effect;
}
#endif
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698