fix ops for very close rects
Pathops sorts line intersections to determine which edges to keep.
If the intersections are very short, they may get discarded and the
adjacent edge is used instead.
If a pair of edges are 180 degrees apart, and an adjacent edge is
part of the sort, it is ambiguous whether it is inside or outside
the span. Add logic to look for this and evaluate the original data
rather than the adjacent edge.
In a separate CL, I'll add a specialization for rect/rect ops.
R=halcanary@google.com
Bug: skia:8049
Change-Id: I8d88d5520051d41303ea683e7d6b844f2afa9937
Reviewed-on: https://skia-review.googlesource.com/132661
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Auto-Submit: Cary Clark <caryclark@skia.org>
diff --git a/tests/PathOpsOpTest.cpp b/tests/PathOpsOpTest.cpp
index 6a379be..cfa9a45 100644
--- a/tests/PathOpsOpTest.cpp
+++ b/tests/PathOpsOpTest.cpp
@@ -5720,6 +5720,15 @@
testPathOp(reporter, path, path2, kIntersect_SkPathOp, filename);
}
+static void halbug(skiatest::Reporter* reporter, const char* filename) {
+ SkPath path, path2;
+ path.setFillType(SkPath::kEvenOdd_FillType);
+ path.addRect(SkRect{278.653992f, 155.747406f, 580.15918f, 593.602051f});
+ path2.setFillType(SkPath::kWinding_FillType);
+ path2.addRect(SkRect{278.657715f, 155.747314f, 580.238281f, 594.114014f});
+ testPathOp(reporter, path, path2, kIntersect_SkPathOp, filename);
+}
+
static void (*skipTest)(skiatest::Reporter* , const char* filename) = 0;
static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0;
static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0;
@@ -5727,6 +5736,7 @@
#define TEST(name) { name, #name }
static struct TestDesc tests[] = {
+ TEST(halbug),
TEST(seanbug),
TEST(android1),
TEST(bug5240),