Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 763593002: Revert of some cleanup around GrGpu/GrDrawTarget copySurface (Closed) Base URL: https://skia.googlesource.com/skia.git@isSameAs
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrGpu.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawTarget.cpp
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 6f7ba66422a362b024c6e2f88313f064f606b5f1..bbf3eca05b4366b1de8727cf5a1b4963dc9f7556 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -921,19 +921,16 @@
dstPoint,
&clippedSrcRect,
&clippedDstPoint)) {
+ SkASSERT(GrDrawTarget::canCopySurface(dst, src, srcRect, dstPoint));
return true;
}
- if (this->onCopySurface(dst, src, clippedSrcRect, clippedDstPoint)) {
- return true;
+ if (!GrDrawTarget::canCopySurface(dst, src, clippedSrcRect, clippedDstPoint)) {
+ return false;
}
GrRenderTarget* rt = dst->asRenderTarget();
GrTexture* tex = src->asTexture();
-
- if ((dst != src) && rt && tex) {
- return false;
- }
GrDrawState drawState;
drawState.setRenderTarget(rt);
@@ -968,13 +965,7 @@
&clippedDstPoint)) {
return true;
}
- return this->internalCanCopySurface(dst, src, clippedSrcRect, clippedDstPoint);
-}
-
-bool GrDrawTarget::internalCanCopySurface(const GrSurface* dst,
- const GrSurface* src,
- const SkIRect& clippedSrcRect,
- const SkIPoint& clippedDstPoint) {
+
// Check that the read/write rects are contained within the src/dst bounds.
SkASSERT(!clippedSrcRect.isEmpty());
SkASSERT(SkIRect::MakeWH(src->width(), src->height()).contains(clippedSrcRect));
@@ -982,9 +973,14 @@
SkASSERT(clippedDstPoint.fX + clippedSrcRect.width() <= dst->width() &&
clippedDstPoint.fY + clippedSrcRect.height() <= dst->height());
- // The base class can do it as a draw or the subclass may be able to handle it.
- return ((dst != src) && dst->asRenderTarget() && src->asTexture()) ||
- this->onCanCopySurface(dst, src, clippedSrcRect, clippedDstPoint);
+ return (dst != src) && dst->asRenderTarget() && src->asTexture();
+}
+
+void GrDrawTarget::initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) {
+ // Make the dst of the copy be a render target because the default copySurface draws to the dst.
+ desc->fOrigin = kDefault_GrSurfaceOrigin;
+ desc->fFlags = kRenderTarget_GrSurfaceFlag | kNoStencil_GrSurfaceFlag;
+ desc->fConfig = src->config();
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698