Review URL: https://codereview.chromium.org/
871373007
}
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) {