aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkAnalyticEdge.cpp
diff options
context:
space:
mode:
authorGravatar Yuqian Li <liyuqian@google.com>2017-01-17 16:15:06 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-18 15:41:48 +0000
commit98cf99b3ae4cc956158d1fd843fc8a84059ae132 (patch)
tree966dc133ce5010a5638bac5e0a67851a5bcf66a1 /src/core/SkAnalyticEdge.cpp
parentfc50dda7ad5b321a203c023b608ec5a87f98c20e (diff)
Turn on concave analytic AA
This will allow Skia trybots to exercise analytic AA. But there's still a guard flag in Chromium that prevents layout tests failure. Additionally, we 1. fixed nagative shift problem 2. relax the ASSERT when slope is too large: If slope is large, the accuracy of the slope is limited due to conversion to SkFDot6 and division. Hence we have to relax the constraint. 3. handle the special case where dx != 0 while slope == 0 because of very large dy and limited precision. BUG=skia: Change-Id: Ice70164f3f396f0db3896bedc7b96fbd613078dc Reviewed-on: https://skia-review.googlesource.com/7120 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
Diffstat (limited to 'src/core/SkAnalyticEdge.cpp')
-rw-r--r--src/core/SkAnalyticEdge.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/SkAnalyticEdge.cpp b/src/core/SkAnalyticEdge.cpp
index 199fc4ef33..213262f3b2 100644
--- a/src/core/SkAnalyticEdge.cpp
+++ b/src/core/SkAnalyticEdge.cpp
@@ -39,7 +39,11 @@ bool SkAnalyticEdge::updateLine(SkFixed x0, SkFixed y0, SkFixed x1, SkFixed y1,
fY = y0;
fUpperY = y0;
fLowerY = y1;
+#ifdef SK_SUPPORT_LEGACY_AAA
fDY = (absSlope | dx) == 0
+#else
+ fDY = (dx == 0 || slope == 0)
+#endif
? SK_MaxS32
: absSlope < kInverseTableSize
? QuickFDot6Inverse::Lookup(absSlope)
@@ -113,7 +117,7 @@ bool SkAnalyticQuadraticEdge::updateQuadratic() {
#ifndef SK_SUPPORT_LEGACY_AAA
SkASSERT(slope == SK_MaxS32 ||
SkAbs32(fSnappedX + SkFixedMul(slope, newSnappedY - fSnappedY) - newSnappedX)
- < SK_FixedHalf);
+ < SkFixedMul(SK_Fixed1 >> 4, SkTMax(SK_Fixed1, SkAbs32(slope))));
#endif
dx += fQEdge.fQDDx;
dy += fQEdge.fQDDy;