Index: src/effects/SkTableColorFilter.cpp |
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp |
index bed99fc9de53a33bafb6e450a6d50a20a8db27b9..4853f73e5c1e7461500b4906a6d145f9275ece65 100644 |
--- a/src/effects/SkTableColorFilter.cpp |
+++ b/src/effects/SkTableColorFilter.cpp |
@@ -418,6 +418,7 @@ |
} |
} |
+ |
/////////////////////////////////////////////////////////////////////////////// |
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ColorTableEffect); |
@@ -433,10 +434,19 @@ |
GrFragmentProcessor* SkTable_ColorFilter::asFragmentProcessor(GrContext* context) const { |
SkBitmap bitmap; |
+ GrFragmentProcessor* fp = NULL; |
this->asComponentTable(&bitmap); |
// passing NULL because this effect does no tiling or filtering. |
- SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(context, bitmap, NULL)); |
- return texture ? ColorTableEffect::Create(texture, fFlags) : NULL; |
+ GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, bitmap, NULL); |
+ if (texture) { |
+ fp = ColorTableEffect::Create(texture, fFlags); |
+ |
+ // Unlock immediately, this is not great, but we don't have a way of |
+ // knowing when else to unlock it currently. TODO: Remove this when |
+ // unref becomes the unlock replacement for all types of textures. |
+ GrUnlockAndUnrefCachedBitmapTexture(texture); |
+ } |
+ return fp; |
} |
#endif // SK_SUPPORT_GPU |