diff options
author | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-09-16 15:55:01 +0000 |
---|---|---|
committer | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-09-16 15:55:01 +0000 |
commit | 570863f2e22b8ea7d7c504bd15e4f766af097df2 (patch) | |
tree | aa07d18266edd483ee71d7be9491da622cf400f3 /src/pathops/SkPathOpsCommon.cpp | |
parent | cf7854057638dfa75e788f3f8babed75d587d444 (diff) |
path ops work in progress
path ops work in progress
BUG=
Review URL: https://codereview.chromium.org/21359002
git-svn-id: http://skia.googlecode.com/svn/trunk@11291 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/pathops/SkPathOpsCommon.cpp')
-rw-r--r-- | src/pathops/SkPathOpsCommon.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/pathops/SkPathOpsCommon.cpp b/src/pathops/SkPathOpsCommon.cpp index 28cf59cdd3..7dd13a7fe8 100644 --- a/src/pathops/SkPathOpsCommon.cpp +++ b/src/pathops/SkPathOpsCommon.cpp @@ -250,6 +250,9 @@ static SkOpSegment* findSortableTop(const SkTArray<SkOpContour*, true>& contourL *topLeft = bestXY; result = topStart->findTop(index, endIndex, unsortable, onlySortable); } while (!result); + if (result) { + *unsortable = false; + } return result; } @@ -288,9 +291,9 @@ static void skipVertical(const SkTArray<SkOpContour*, true>& contourList, } } -SkOpSegment* FindSortableTop(const SkTArray<SkOpContour*, true>& contourList, bool* firstContour, - int* indexPtr, int* endIndexPtr, SkPoint* topLeft, bool* unsortable, - bool* done, bool binary) { +SkOpSegment* FindSortableTop(const SkTArray<SkOpContour*, true>& contourList, + SkOpAngle::IncludeType angleIncludeType, bool* firstContour, int* indexPtr, + int* endIndexPtr, SkPoint* topLeft, bool* unsortable, bool* done) { SkOpSegment* current = findSortableTop(contourList, indexPtr, endIndexPtr, topLeft, unsortable, done, true); if (!current) { @@ -308,8 +311,11 @@ SkOpSegment* FindSortableTop(const SkTArray<SkOpContour*, true>& contourList, bo if (sumWinding != SK_MinS32) { return current; } - sumWinding = current->computeSum(index, endIndex, binary); - if (sumWinding != SK_MinS32) { + SkASSERT(current->windSum(SkMin32(index, endIndex)) == SK_MinS32); + SkSTArray<SkOpAngle::kStackBasedCount, SkOpAngle, true> angles; + SkSTArray<SkOpAngle::kStackBasedCount, SkOpAngle*, true> sorted; + sumWinding = current->computeSum(index, endIndex, angleIncludeType, &angles, &sorted); + if (sumWinding != SK_MinS32 && sumWinding != SK_NaN32) { return current; } int contourWinding; @@ -333,7 +339,7 @@ SkOpSegment* FindSortableTop(const SkTArray<SkOpContour*, true>& contourList, bo if (tryAgain) { continue; } - if (!binary) { + if (angleIncludeType < SkOpAngle::kBinarySingle) { break; } oppContourWinding = rightAngleWinding(contourList, ¤t, indexPtr, endIndexPtr, &tHit, @@ -354,6 +360,15 @@ void CheckEnds(SkTArray<SkOpContour*, true>* contourList) { } } +// A tiny interval may indicate an undiscovered coincidence. Find and fix. +void CheckTiny(SkTArray<SkOpContour*, true>* contourList) { + int contourCount = (*contourList).count(); + for (int cTest = 0; cTest < contourCount; ++cTest) { + SkOpContour* contour = (*contourList)[cTest]; + contour->checkTiny(); + } +} + void FixOtherTIndex(SkTArray<SkOpContour*, true>* contourList) { int contourCount = (*contourList).count(); for (int cTest = 0; cTest < contourCount; ++cTest) { |