aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkScan_AAAPath.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/SkScan_AAAPath.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/SkScan_AAAPath.cpp')
-rw-r--r--src/core/SkScan_AAAPath.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/core/SkScan_AAAPath.cpp b/src/core/SkScan_AAAPath.cpp
index 126322820f..af45f0094f 100644
--- a/src/core/SkScan_AAAPath.cpp
+++ b/src/core/SkScan_AAAPath.cpp
@@ -736,14 +736,14 @@ static void blit_aaa_trapezoid_row(AdditiveBlitter* blitter, int y,
int uL = SkFixedFloorToInt(ul);
int lL = SkFixedCeilToInt(ll);
if (uL + 2 == lL) { // We only need to compute two triangles, accelerate this special case
- SkFixed first = (uL << 16) + SK_Fixed1 - ul;
+ SkFixed first = SkIntToFixed(uL) + SK_Fixed1 - ul;
SkFixed second = ll - ul - first;
SkAlpha a1 = fullAlpha - partialTriangleToAlpha(first, lDY);
SkAlpha a2 = partialTriangleToAlpha(second, lDY);
alphas[0] = alphas[0] > a1 ? alphas[0] - a1 : 0;
alphas[1] = alphas[1] > a2 ? alphas[1] - a2 : 0;
} else {
- computeAlphaBelowLine(tempAlphas + uL - L, ul - (uL << 16), ll - (uL << 16),
+ computeAlphaBelowLine(tempAlphas + uL - L, ul - SkIntToFixed(uL), ll - SkIntToFixed(uL),
lDY, fullAlpha);
for (int i = uL; i < lL; ++i) {
if (alphas[i - L] > tempAlphas[i - L]) {
@@ -757,14 +757,14 @@ static void blit_aaa_trapezoid_row(AdditiveBlitter* blitter, int y,
int uR = SkFixedFloorToInt(ur);
int lR = SkFixedCeilToInt(lr);
if (uR + 2 == lR) { // We only need to compute two triangles, accelerate this special case
- SkFixed first = (uR << 16) + SK_Fixed1 - ur;
+ SkFixed first = SkIntToFixed(uR) + SK_Fixed1 - ur;
SkFixed second = lr - ur - first;
SkAlpha a1 = partialTriangleToAlpha(first, rDY);
SkAlpha a2 = fullAlpha - partialTriangleToAlpha(second, rDY);
alphas[len-2] = alphas[len-2] > a1 ? alphas[len-2] - a1 : 0;
alphas[len-1] = alphas[len-1] > a2 ? alphas[len-1] - a2 : 0;
} else {
- computeAlphaAboveLine(tempAlphas + uR - L, ur - (uR << 16), lr - (uR << 16),
+ computeAlphaAboveLine(tempAlphas + uR - L, ur - SkIntToFixed(uR), lr - SkIntToFixed(uR),
rDY, fullAlpha);
for (int i = uR; i < lR; ++i) {
if (alphas[i - L] > tempAlphas[i - L]) {
@@ -1605,7 +1605,9 @@ static void aaa_walk_edges(SkAnalyticEdge* prevHead, SkAnalyticEdge* nextTail,
leftEnds, false, blitter, maskRow, isUsingMask, noRealBlitter,
leftClip, rightClip, yShift);
} else {
- blit_trapezoid_row(blitter, y >> 16, left, rightClip, leftE->fX, rightClip,
+ blit_trapezoid_row(blitter, y >> 16,
+ SkTMax(leftClip, left), rightClip,
+ SkTMax(leftClip, leftE->fX), rightClip,
leftDY, 0, fullAlpha, maskRow, isUsingMask,
noRealBlitter ||
(fullAlpha == 0xFF && edges_too_close(leftE->fPrev, leftE, nextY)),