Fix last pathops skp bug
This fixes the last bug discovered by iterating through the 800K
skp corpus representing the top 1M websites. For every clip on the
stack, the paths are replaced with the pathop intersection. The
resulting draw is compared with the original draw for pixel errors.
At least two prominent bugs remain. In one, the winding value is
confused by a cubic with an inflection. In the other, a quad/cubic
pair, nearly coincident, fails to find an intersection.
These minor changes include ignoring very tiny self-intersections
of cubics, and processing degenerate edges that don't connect to
anything else.
R=reed@android.com
TBR=reed
Author: caryclark@google.com
Review URL: https://codereview.chromium.org/340103002
diff --git a/src/pathops/SkDCubicIntersection.cpp b/src/pathops/SkDCubicIntersection.cpp
index 1c237d9..9d83242 100644
--- a/src/pathops/SkDCubicIntersection.cpp
+++ b/src/pathops/SkDCubicIntersection.cpp
@@ -681,11 +681,17 @@
if (c.endsAreExtremaInXOrY()) {
return false;
}
+ // OPTIMIZATION: could quick reject if neither end point tangent ray intersected the line
+ // segment formed by the opposite end point to the control point
(void) intersect(c, c);
if (used() > 0) {
- SkASSERT(used() == 1);
- if (fT[0][0] > fT[1][0]) {
- swapPts();
+ if (approximately_equal_double(fT[0][0], fT[1][0])) {
+ fUsed = 0;
+ } else {
+ SkASSERT(used() == 1);
+ if (fT[0][0] > fT[1][0]) {
+ swapPts();
+ }
}
}
return used();