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

Unified Diff: src/gpu/GrDrawContext.cpp

Issue 1551883003: Move path fallback for AA rect out of SkGpuDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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 | « no previous file | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawContext.cpp
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index 492d425dada71242c6a941fa82ebe57adc9a636e..c0e3d02095880d2ee0b422d7b7e022f7badc0c80 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -268,28 +268,35 @@ void GrDrawContext::drawRect(const GrClip& clip,
}
}
- GrColor color = paint.getColor();
- bool needAA = should_apply_coverage_aa(paint, fRenderTarget);
-
- // The fill path can handle rotation but not skew
- // The stroke path needs the rect to remain axis aligned (no rotation or skew)
- // None of our AA draw rect calls can handle perspective yet
- bool canApplyAA = width >=0 ? viewMatrix.rectStaysRect() :
- view_matrix_ok_for_aa_fill_rect(viewMatrix);
-
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip);
+ GrColor color = paint.getColor();
- if (needAA && canApplyAA) {
- SkASSERT(!viewMatrix.hasPerspective());
+ if (should_apply_coverage_aa(paint, fRenderTarget)) {
SkAutoTUnref<GrDrawBatch> batch;
if (width >= 0) {
- batch.reset(GrRectBatchFactory::CreateAAStroke(color, viewMatrix, rect, *strokeInfo));
+ // The stroke path needs the rect to remain axis aligned (no rotation or skew).
+ if (viewMatrix.rectStaysRect()) {
+ batch.reset(GrRectBatchFactory::CreateAAStroke(color, viewMatrix, rect,
+ *strokeInfo));
+ }
} else {
- SkRect devBoundRect;
- viewMatrix.mapRect(&devBoundRect, rect);
- batch.reset(GrRectBatchFactory::CreateAAFill(color, viewMatrix, rect, devBoundRect));
+ // The fill path can handle rotation but not skew.
+ if (view_matrix_ok_for_aa_fill_rect(viewMatrix)) {
+ SkRect devBoundRect;
+ viewMatrix.mapRect(&devBoundRect, rect);
+ batch.reset(GrRectBatchFactory::CreateAAFill(color, viewMatrix, rect,
+ devBoundRect));
+ }
+ }
+ if (batch) {
+ this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
+ } else {
+ SkPath path;
+ path.setIsVolatile(true);
+ path.addRect(rect);
+ this->internalDrawPath(&pipelineBuilder, viewMatrix, color, true, path, *strokeInfo);
+ SkASSERT(paint.isAntiAlias());
}
- this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
return;
}
« no previous file with comments | « no previous file | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698