Index: src/core/SkAAClip.cpp |
diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp |
index c7e1ead9098f2df92d43a751947544e2ea128019..1a60754d91370a1888a6b99842bf77de24b88580 100644 |
--- a/src/core/SkAAClip.cpp |
+++ b/src/core/SkAAClip.cpp |
@@ -1331,12 +1331,16 @@ public: |
} |
// 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. |
caryclark
2016/11/07 16:50:51
The assert below disagrees with the comment; it as
liyuqian
2016/11/08 16:33:47
Is SkASSERT(0x10 > *alpha) equivalent to SkASSERT(
|
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 @@ public: |
} |
int right = x + count; |
if (right > fRight) { |
- SkASSERT(0 == *alpha); |
+ SkASSERT(0x10 > *alpha); |
localCount -= right - fRight; |
SkASSERT(localCount >= 0); |
} |