aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2016-12-06 14:47:34 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-06 21:43:56 +0000
commitc57c7c948a851fe792a504207fcf530da573cc59 (patch)
treec2beafd301817e0219c215eb2287a3a46dfaa134
parent864f6bde37273f1f66a74acf0a19eee1210919e1 (diff)
Rewrite GrRenderTargetContext::drawRegion antialias logic.
This will hopefully make a later change that refactors how aa is passed to GrRenderTargetContext a little easier to review. Change-Id: Ie750d237714a0407ec1e5604c0daa080da32519b Reviewed-on: https://skia-review.googlesource.com/5630 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
-rw-r--r--src/gpu/GrRenderTargetContext.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 2cd08e63f7..90cc6cbd9e 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -1084,11 +1084,16 @@ void GrRenderTargetContext::drawRegion(const GrClip& clip,
SkDEBUGCODE(this->validate();)
GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawRegion");
- bool isNonTranslate = SkToBool(viewMatrix.getType() & ~(SkMatrix::kTranslate_Mask));
+ bool needsAA = false;
+ if (paint.isAntiAlias()) {
+ // GrRegionBatch performs no antialiasing but is much faster, so here we check the matrix
+ // to see whether aa is really required.
+ needsAA = SkToBool(viewMatrix.getType() & ~(SkMatrix::kTranslate_Mask)) ||
+ !is_int(viewMatrix.getTranslateX()) ||
+ !is_int(viewMatrix.getTranslateY());
+ }
bool complexStyle = !style.isSimpleFill();
- bool antiAlias = paint.isAntiAlias() && (!is_int(viewMatrix.getTranslateX()) ||
- !is_int(viewMatrix.getTranslateY()));
- if (isNonTranslate || complexStyle || antiAlias) {
+ if (complexStyle || needsAA) {
SkPath path;
region.getBoundaryPath(&path);
return this->drawPath(clip, paint, viewMatrix, path, style);