aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrRenderTargetContext.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2016-12-15 09:23:05 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-15 15:07:39 +0000
commite2f7d1899d890c2f08571e1bd6c7fa2c5ea1be0b (patch)
treed290f1a9d5d5e828c7177d230f56356f9fc9bf2e /src/gpu/GrRenderTargetContext.cpp
parentdb8f44f497f2b67b2500bbfc7b11ce7a510c5e5c (diff)
Add a deferred copy surface (take 3)
This CL forces all GrSurface copies to go through a GrSurfaceContext (rather than GrContext). There is a bit of goofiness going on here until read/writePixels is also consolidated in GrSurfaceContext and a proxy-backed SkImage/SkSurface is added. This is a reland of https://skia-review.googlesource.com/c/5773/ (Add a deferred copy surface) Change-Id: Ib8fd96d0569274ef781366eb900ed8ee839ae9bd Reviewed-on: https://skia-review.googlesource.com/6109 Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrRenderTargetContext.cpp')
-rw-r--r--src/gpu/GrRenderTargetContext.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 1ba66acac6..ee87dae13b 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -133,12 +133,20 @@ GrRenderTargetOpList* GrRenderTargetContext::getOpList() {
return fOpList;
}
-bool GrRenderTargetContext::copySurface(GrSurface* src, const SkIRect& srcRect,
- const SkIPoint& dstPoint) {
+// TODO: move this (and GrTextContext::copy) to GrSurfaceContext?
+bool GrRenderTargetContext::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, "GrRenderTargetContext::copySurface");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::copy");
+
+ // TODO: defer instantiation until flush time
+ sk_sp<GrSurface> src(sk_ref_sp(srcProxy->instantiate(fContext->textureProvider())));
+ if (!src) {
+ return false;
+ }
// TODO: this needs to be fixed up since it ends the deferrable of the GrRenderTarget
sk_sp<GrRenderTarget> rt(
@@ -147,7 +155,7 @@ bool GrRenderTargetContext::copySurface(GrSurface* src, const SkIRect& srcRect,
return false;
}
- return this->getOpList()->copySurface(rt.get(), src, srcRect, dstPoint);
+ return this->getOpList()->copySurface(rt.get(), src.get(), srcRect, dstPoint);
}
void GrRenderTargetContext::drawText(const GrClip& clip, const GrPaint& grPaint,