Index: src/gpu/GrContext.cpp |
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp |
index ea3ea281fef063416f2a97a0f1d8672f58a6b326..6879b109cd76c0c6b64b130346a5204d3c72888c 100755 |
--- a/src/gpu/GrContext.cpp |
+++ b/src/gpu/GrContext.cpp |
@@ -473,7 +473,12 @@ GrTexture* GrContext::refScratchTexture(const GrSurfaceDesc& inDesc, ScratchTexM |
} |
GrGpuResource* resource = fResourceCache2->findAndRefScratchResource(key, scratchFlags); |
if (resource) { |
- return static_cast<GrSurface*>(resource)->asTexture(); |
+ GrSurface* surface = static_cast<GrSurface*>(resource); |
+ GrRenderTarget* rt = surface->asRenderTarget(); |
+ if (rt && fGpu->caps()->discardRenderTargetSupport()) { |
+ rt->discard(); |
+ } |
+ return surface->asTexture(); |
} |
if (kExact_ScratchTexMatch == match) { |