Relax the extra span's alpha
BUG=chrome:662862
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2477393002
Review-Url: https://codereview.chromium.org/2477393002
diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp
index c7e1ead..1a60754 100644
--- a/src/core/SkAAClip.cpp
+++ b/src/core/SkAAClip.cpp
@@ -1331,12 +1331,16 @@
}
// The supersampler's buffer can be the width of the device, so
- // we may have to trim the run to our bounds. If so, we assert that
- // the extra spans are always alpha==0
+ // we may have to trim the run to our bounds. Previously, we assert that
+ // the extra spans are always alpha==0.
+ // However, the analytic AA is too sensitive to precision errors
+ // so it may have extra spans with very tiny alpha because after several
+ // arithmatic operations, the edge may bleed the path boundary a little bit.
+ // Therefore, instead of always asserting alpha==0, we assert alpha < 0x10.
int localX = x;
int localCount = count;
if (x < fLeft) {
- SkASSERT(0 == *alpha);
+ SkASSERT(0x10 > *alpha);
int gap = fLeft - x;
SkASSERT(gap <= count);
localX += gap;
@@ -1344,7 +1348,7 @@
}
int right = x + count;
if (right > fRight) {
- SkASSERT(0 == *alpha);
+ SkASSERT(0x10 > *alpha);
localCount -= right - fRight;
SkASSERT(localCount >= 0);
}