Index: src/gpu/GrContext.cpp |
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp |
index 89548ab5c956ee4fd066cef2774746ef8264de18..8084557c933ff236d3d804ac4212681d799042c5 100644 |
--- a/src/gpu/GrContext.cpp |
+++ b/src/gpu/GrContext.cpp |
@@ -457,6 +457,11 @@ GrTexture* GrContext::lockAndRefScratchTexture(const GrTextureDesc& inDesc, Scra |
// Ensure we have exclusive access to the texture so future 'find' calls don't return it |
resource = fTextureCache->find(key, GrResourceCache::kHide_OwnershipFlag); |
if (NULL != resource) { |
+ // If the scratch texture is a render target, discard its contents. |
+ GrRenderTarget* rt = static_cast<GrTexture*>(resource)->asRenderTarget(); |
+ if (NULL != rt) { |
+ rt->discard(); |
+ } |
resource->ref(); |
break; |
} |