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, ¶ms); |
+ GrTexture* texture = fRawBitmap.getTexture(); |
+ bool didLockTexture = false; |
+ |
+ if (!texture) { |
+ texture = GrLockAndRefCachedBitmapTexture(context, fRawBitmap, ¶ms); |
+ 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 |