Index: src/effects/SkColorCubeFilter.cpp |
diff --git a/src/effects/SkColorCubeFilter.cpp b/src/effects/SkColorCubeFilter.cpp |
index 22425983d1aecbcbb2f03643b3d183f0f3d944c3..d9d6841e50019c4a83d802880afe01a3f0bbc7b6 100644 |
--- a/src/effects/SkColorCubeFilter.cpp |
+++ b/src/effects/SkColorCubeFilter.cpp |
@@ -356,11 +356,12 @@ GrFragmentProcessor* SkColorCubeFilter::asFragmentProcessor(GrContext* context) |
desc.fHeight = fCache.cubeDimension() * fCache.cubeDimension(); |
desc.fConfig = kRGBA_8888_GrPixelConfig; |
- SkAutoTUnref<GrTexture> textureCube( |
- static_cast<GrTexture*>(context->findAndRefCachedResource( |
- GrTexturePriv::ComputeKey(context->getGpu(), NULL, desc, cacheID)))); |
- |
- if (!textureCube) { |
+ GrResourceKey rkey = GrTexturePriv::ComputeKey(context->getGpu(), NULL, desc, cacheID); |
+ GrSurface* surface = static_cast<GrSurface*>(context->findAndRefCachedResource(rkey)); |
+ SkAutoTUnref<GrTexture> textureCube; |
+ if (surface) { |
+ textureCube.reset(surface->asTexture()); |
+ } else { |
textureCube.reset(context->createTexture(NULL, desc, cacheID, fCubeData->data(), 0)); |
} |