Skip adding coincident edges found
during curve intersection if their
ends are nearly the same.
Loosen conic/line intersection point
check.
Detect when coincident points are
unordered. This means that points
a/b/c on one curve may appear in
b/c/a order on the opposite curve.
Restructure addMissing to return
success and return if a coincidence
was added as a parameter.
With this, tiger part a works.
Tiger part b exposes bugs around
tight quads that are nearly coincident
with themselves, and are coincident
with something else.
The greedy coicident matcher
may cause the point order to be
out of sync.
Still working out what to do in
this case.
TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2321773002
Review-Url: https://codereview.chromium.org/2321773002
diff --git a/src/pathops/SkOpSpan.cpp b/src/pathops/SkOpSpan.cpp
index 70b47b6..26c6f25 100755
--- a/src/pathops/SkOpSpan.cpp
+++ b/src/pathops/SkOpSpan.cpp
@@ -459,7 +459,7 @@
}
// Please keep this in sync with debugInsertCoincidence()
-bool SkOpSpan::insertCoincidence(const SkOpSegment* segment, bool flipped) {
+bool SkOpSpan::insertCoincidence(const SkOpSegment* segment, bool flipped, bool ordered) {
if (this->containsCoincidence(segment)) {
return true;
}
@@ -467,16 +467,16 @@
while ((next = next->next()) != &fPtT) {
if (next->segment() == segment) {
SkOpSpan* span;
- if (flipped) {
- span = next->span()->prev();
- if (!span) {
- return false;
- }
+ SkOpSpanBase* base = next->span();
+ if (!ordered) {
+ const SkOpSpanBase* spanEnd = fNext->contains(segment)->span();
+ const SkOpPtT* start = base->ptT()->starter(spanEnd->ptT());
+ span = const_cast<SkOpSpan*>(start->span()->upCast());
+ } else if (flipped) {
+ span = base->prev();
+ FAIL_IF(!span);
} else {
- SkOpSpanBase* base = next->span();
- if (!base->upCastable()) {
- return false;
- }
+ FAIL_IF(!base->upCastable());
span = base->upCast();
}
this->insertCoincidence(span);