diff options
author | caryclark <caryclark@google.com> | 2016-08-31 14:36:29 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-31 14:36:30 -0700 |
commit | 30b9fdd6a1d607bde20c793af65b5e2e8a1737ca (patch) | |
tree | dede5477d934673f3857fb1cf21ae9af4988f7bc /src/pathops/SkOpSegment.cpp | |
parent | 8abb370aca280516f4861c6c942ec453aad018fa (diff) |
pathops coincident work
This is working towards fixing all bugs around simplifying the tiger.
This installment simplifies the point-t intersection list as it is built rather than doing the analysis once the intersections are complete. This avoids getting the list in an inconsistent state and makes coincident checks faster and more stable.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2237223002
TBR=reed@google.com
BUG=skia:5131
Review-Url: https://codereview.chromium.org/2237223002
Diffstat (limited to 'src/pathops/SkOpSegment.cpp')
-rw-r--r-- | src/pathops/SkOpSegment.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/pathops/SkOpSegment.cpp b/src/pathops/SkOpSegment.cpp index 3c63683285..6a62175032 100644 --- a/src/pathops/SkOpSegment.cpp +++ b/src/pathops/SkOpSegment.cpp @@ -262,6 +262,7 @@ bool SkOpSegment::addExpanded(double newT, const SkOpSpanBase* test, bool* start SkOpPtT* oppPrev = test->ptT()->oppPrev(newPtT); if (oppPrev) { SkOpSpanBase* writableTest = const_cast<SkOpSpanBase*>(test); + writableTest->mergeMatches(newPtT->span()); writableTest->ptT()->addOpp(newPtT, oppPrev); writableTest->checkForCollapsedCoincidence(); } @@ -355,6 +356,16 @@ bool SkOpSegment::collapsed() const { return fVerb < SkPath::kCubic_Verb && fHead.pt() == fTail.pt(); } +bool SkOpSegment::collapsed(double s, double e) const { + const SkOpSpanBase* span = &fHead; + do { + if (span->collapsed(s, e)) { + return true; + } + } while (span->upCastable() && (span = span->upCast()->next())); + return false; +} + void SkOpSegment::ComputeOneSum(const SkOpAngle* baseAngle, SkOpAngle* nextAngle, SkOpAngle::IncludeType includeType) { SkOpSegment* baseSegment = baseAngle->segment(); @@ -1300,13 +1311,8 @@ bool SkOpSegment::moveMultiples() { goto tryNextSpan; foundMatch: // merge oppTest and oppSpan oppSegment->debugValidate(); - if (oppTest == &oppSegment->fTail || oppTest == &oppSegment->fHead) { - SkASSERT(oppSpan != &oppSegment->fHead); // don't expect collapse - SkASSERT(oppSpan != &oppSegment->fTail); - oppTest->merge(oppSpan->upCast()); - } else { - oppSpan->merge(oppTest->upCast()); - } + oppTest->mergeMatches(oppSpan); + oppTest->addOpp(oppSpan); oppSegment->debugValidate(); goto checkNextSpan; } @@ -1326,14 +1332,14 @@ bool SkOpSegment::spansNearby(const SkOpSpanBase* refSpan, const SkOpSpanBase* c const SkOpPtT* refHead = refSpan->ptT(); const SkOpPtT* checkHead = checkSpan->ptT(); // if the first pt pair from adjacent spans are far apart, assume that all are far enough apart - if (!SkDPoint::RoughlyEqual(refHead->fPt, checkHead->fPt)) { + if (!SkDPoint::WayRoughlyEqual(refHead->fPt, checkHead->fPt)) { #if DEBUG_COINCIDENCE // verify that no combination of points are close const SkOpPtT* dBugRef = refHead; do { const SkOpPtT* dBugCheck = checkHead; do { - SkASSERT(!SkDPoint::ApproximatelyEqual(dBugRef->fPt, dBugCheck->fPt)); + SkOPASSERT(!SkDPoint::ApproximatelyEqual(dBugRef->fPt, dBugCheck->fPt)); dBugCheck = dBugCheck->next(); } while (dBugCheck != checkHead); dBugRef = dBugRef->next(); @@ -1684,7 +1690,7 @@ bool SkOpSegment::testForCoincidence(const SkOpPtT* priorPtT, const SkOpPtT* ptT continue; } SkDPoint oppPt = i.pt(index); - if (oppPt.approximatelyEqual(midPt)) { + if (oppPt.approximatelyDEqual(midPt)) { // the coincidence can occur at almost any angle coincident = true; } |