aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-07 17:03:00 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-07 17:03:00 +0000
commit0f23ff1bcc9c725f0073a5b5689e86ea86c7f69b (patch)
treee7276b22dd5534ac40cffe106b6e749f78100904 /src
parent0d0d620bfd703a6515b0c3a86f874c27e568aad0 (diff)
Discard scratch render targets before reusing them.
R=robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/225183012 git-svn-id: http://skia.googlecode.com/svn/trunk@14075 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-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;
}