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

Unified Diff: src/gpu/GrDrawContext.cpp

Issue 1295523002: stop dropping AA when rect stays rect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean Created 5 years, 4 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 | « no previous file | no next file » | 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 303361114655bf9fdfdfe590b3ce212be35dd1a5..8b956476312f7c3d61ae6a33a9f001490124aa62 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -204,35 +204,6 @@ void GrDrawContext::drawPaint(GrRenderTarget* rt,
}
}
-static inline bool is_irect(const SkRect& r) {
- return SkScalarIsInt(r.fLeft) && SkScalarIsInt(r.fTop) &&
- SkScalarIsInt(r.fRight) && SkScalarIsInt(r.fBottom);
-}
-
-static bool apply_aa_to_rect(GrDrawTarget* target,
- GrPipelineBuilder* pipelineBuilder,
- SkRect* devBoundRect,
- const SkRect& rect,
- SkScalar strokeWidth,
- const SkMatrix& combinedMatrix,
- GrColor color) {
- if (pipelineBuilder->getRenderTarget()->isUnifiedMultisampled() ||
- !combinedMatrix.preservesAxisAlignment()) {
- return false;
- }
-
- combinedMatrix.mapRect(devBoundRect, rect);
- if (!combinedMatrix.rectStaysRect()) {
- return true;
- }
-
- if (strokeWidth < 0) {
- return !is_irect(*devBoundRect);
- }
-
- return true;
-}
-
static inline bool rect_contains_inclusive(const SkRect& rect, const SkPoint& point) {
return point.fX >= rect.fLeft && point.fX <= rect.fRight &&
point.fY >= rect.fTop && point.fY <= rect.fBottom;
@@ -297,13 +268,18 @@ void GrDrawContext::drawRect(GrRenderTarget* rt,
}
GrColor color = paint.getColor();
- SkRect devBoundRect;
bool needAA = paint.isAntiAlias() &&
!pipelineBuilder.getRenderTarget()->isUnifiedMultisampled();
- bool doAA = needAA && apply_aa_to_rect(fDrawTarget, &pipelineBuilder, &devBoundRect, rect,
- width, viewMatrix, color);
- if (doAA) {
+ // 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 draw rect calls can handle perspective yet
+ SkASSERT(!viewMatrix.hasPerspective());
+ bool canApplyAA = width >=0 ? viewMatrix.rectStaysRect() : viewMatrix.preservesRightAngles();
+
+ if (needAA && canApplyAA) {
+ SkRect devBoundRect;
+ viewMatrix.mapRect(&devBoundRect, rect);
SkAutoTUnref<GrDrawBatch> batch;
if (width >= 0) {
batch.reset(GrRectBatchFactory::CreateStrokeAA(color, viewMatrix, rect, devBoundRect,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698