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

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 1161063003: Revert "Revert of Move copy-surface-as-draw fallback to GrGLGpu. (patchset #12 id:220001 of https:/… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 5 years, 7 months 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 71b5674543edebbd6a8ae9affc2f83cbb8f36fb2..ee668f014c8d1c2038f29337a988bc0c39f10b15 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -104,13 +104,10 @@ bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil
return false;
}
SkIPoint dstPoint = {0, 0};
- if (this->copySurface(copy, rt, copyRect, dstPoint)) {
- dstTexture->setTexture(copy);
- dstTexture->setOffset(copyRect.fLeft, copyRect.fTop);
- return true;
- } else {
- return false;
- }
+ this->copySurface(copy, rt, copyRect, dstPoint);
+ dstTexture->setTexture(copy);
+ dstTexture->setOffset(copyRect.fLeft, copyRect.fTop);
+ return true;
}
void GrDrawTarget::flush() {
@@ -433,7 +430,7 @@ bool clip_srcrect_and_dstpoint(const GrSurface* dst,
}
}
-bool GrDrawTarget::copySurface(GrSurface* dst,
+void GrDrawTarget::copySurface(GrSurface* dst,
GrSurface* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
@@ -449,56 +446,10 @@ bool GrDrawTarget::copySurface(GrSurface* dst,
dstPoint,
&clippedSrcRect,
&clippedDstPoint)) {
- return true;
- }
-
- if (this->getGpu()->canCopySurface(dst, src, clippedSrcRect, clippedDstPoint)) {
- this->onCopySurface(dst, src, clippedSrcRect, clippedDstPoint);
- return true;
- }
-
- GrRenderTarget* rt = dst->asRenderTarget();
- GrTexture* tex = src->asTexture();
-
- if ((dst == src) || !rt || !tex) {
- return false;
+ return;
}
- GrPipelineBuilder pipelineBuilder;
- pipelineBuilder.setRenderTarget(rt);
- SkMatrix matrix;
- matrix.setTranslate(SkIntToScalar(clippedSrcRect.fLeft - clippedDstPoint.fX),
- SkIntToScalar(clippedSrcRect.fTop - clippedDstPoint.fY));
- matrix.postIDiv(tex->width(), tex->height());
- pipelineBuilder.addColorTextureProcessor(tex, matrix);
- SkIRect dstRect = SkIRect::MakeXYWH(clippedDstPoint.fX,
- clippedDstPoint.fY,
- clippedSrcRect.width(),
- clippedSrcRect.height());
- this->drawSimpleRect(&pipelineBuilder, GrColor_WHITE, SkMatrix::I(), dstRect);
- return true;
-}
-
-bool GrDrawTarget::canCopySurface(const GrSurface* dst,
- const GrSurface* src,
- const SkIRect& srcRect,
- const SkIPoint& dstPoint) {
- SkASSERT(dst);
- SkASSERT(src);
-
- SkIRect clippedSrcRect;
- SkIPoint clippedDstPoint;
- // If the rect is outside the src or dst then we're guaranteed success
- if (!clip_srcrect_and_dstpoint(dst,
- src,
- srcRect,
- dstPoint,
- &clippedSrcRect,
- &clippedDstPoint)) {
- return true;
- }
- return ((dst != src) && dst->asRenderTarget() && src->asTexture()) ||
- this->getGpu()->canCopySurface(dst, src, clippedSrcRect, clippedDstPoint);
+ this->onCopySurface(dst, src, clippedSrcRect, clippedDstPoint);
}
void GrDrawTarget::setupPipeline(const PipelineInfo& pipelineInfo,
« 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