don't fix winding for empty paths
A path can be non-empty but become empty when it is simplified.
For instance, a path with the same rectangle, twice, with opposite
windings.
No contours are created for empty paths, so don't try to
fix their winding direction.
Additionally, check for a NULL coincidence since the
OpBuilder assumes that no concidence edges can be present
after the paths are simplified. This code should not get
called, but it's worth the future-proofing to check.
R=fmalita@chromium.org
BUG=502792
Review URL: https://codereview.chromium.org/1218863005
diff --git a/src/pathops/SkOpBuilder.cpp b/src/pathops/SkOpBuilder.cpp
index 2fbd4f0..0d229a8 100644
--- a/src/pathops/SkOpBuilder.cpp
+++ b/src/pathops/SkOpBuilder.cpp
@@ -158,9 +158,11 @@
*result = original;
return false;
}
- // convert the even odd result back to winding form before accumulating it
- FixWinding(&fPathRefs[index]);
- sum.addPath(fPathRefs[index]);
+ if (!fPathRefs[index].isEmpty()) {
+ // convert the even odd result back to winding form before accumulating it
+ FixWinding(&fPathRefs[index]);
+ sum.addPath(fPathRefs[index]);
+ }
}
reset();
bool success = Simplify(sum, result);