aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrContext.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 89548ab5c9..8084557c93 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;
}