diff options
Diffstat (limited to 'src/gpu/GrTextureContext.cpp')
-rw-r--r-- | src/gpu/GrTextureContext.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/gpu/GrTextureContext.cpp b/src/gpu/GrTextureContext.cpp index f41fcd1837..68e94f9be3 100644 --- a/src/gpu/GrTextureContext.cpp +++ b/src/gpu/GrTextureContext.cpp @@ -68,16 +68,32 @@ GrTextureOpList* GrTextureContext::getOpList() { return fOpList.get(); } -// MDB TODO: move this (and GrRenderTargetContext::copy) to GrSurfaceContext? +// TODO: move this (and GrRenderTargetContext::copy) to GrSurfaceContext? bool GrTextureContext::onCopy(GrSurfaceProxy* srcProxy, const SkIRect& srcRect, const SkIPoint& dstPoint) { ASSERT_SINGLE_OWNER RETURN_FALSE_IF_ABANDONED SkDEBUGCODE(this->validate();) - GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrTextureContext::onCopy"); + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrTextureContext::copy"); - return this->getOpList()->copySurface(fContext->resourceProvider(), - fTextureProxy.get(), srcProxy, srcRect, dstPoint); +#ifndef ENABLE_MDB + // We can't yet fully defer copies to textures, so GrTextureContext::copySurface will + // execute the copy immediately. Ensure the data is ready. + fContext->contextPriv().flushSurfaceWrites(srcProxy); +#endif + + GrTextureOpList* opList = this->getOpList(); + bool result = opList->copySurface(fContext->resourceProvider(), + fTextureProxy.get(), srcProxy, srcRect, dstPoint); + +#ifndef ENABLE_MDB + GrOpFlushState flushState(fContext->getGpu(), nullptr); + opList->prepareOps(&flushState); + opList->executeOps(&flushState); + opList->reset(); +#endif + + return result; } |