| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 #include "SkAddIntersections.h" | 7 #include "SkAddIntersections.h" |
| 8 #include "SkOpEdgeBuilder.h" | 8 #include "SkOpEdgeBuilder.h" |
| 9 #include "SkPathOpsCommon.h" | 9 #include "SkPathOpsCommon.h" |
| 10 #include "SkPathWriter.h" | 10 #include "SkPathWriter.h" |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 SkASSERT(sLink[rIndex] == SK_MaxS32); | 692 SkASSERT(sLink[rIndex] == SK_MaxS32); |
| 693 SkASSERT(eLink[rIndex] == SK_MaxS32); | 693 SkASSERT(eLink[rIndex] == SK_MaxS32); |
| 694 } | 694 } |
| 695 #endif | 695 #endif |
| 696 } | 696 } |
| 697 | 697 |
| 698 bool HandleCoincidence(SkTArray<SkOpContour*, true>* contourList, int total) { | 698 bool HandleCoincidence(SkTArray<SkOpContour*, true>* contourList, int total) { |
| 699 #if DEBUG_SHOW_WINDING | 699 #if DEBUG_SHOW_WINDING |
| 700 SkOpContour::debugShowWindingValues(contourList); | 700 SkOpContour::debugShowWindingValues(contourList); |
| 701 #endif | 701 #endif |
| 702 CoincidenceCheck(contourList, total); | 702 if (!CoincidenceCheck(contourList, total)) { |
| 703 return false; |
| 704 } |
| 703 #if DEBUG_SHOW_WINDING | 705 #if DEBUG_SHOW_WINDING |
| 704 SkOpContour::debugShowWindingValues(contourList); | 706 SkOpContour::debugShowWindingValues(contourList); |
| 705 #endif | 707 #endif |
| 706 fixOtherTIndex(contourList); | 708 fixOtherTIndex(contourList); |
| 707 checkEnds(contourList); // check if connecting curve intersected at the sam
e end | 709 checkEnds(contourList); // check if connecting curve intersected at the sam
e end |
| 708 bool hasM = checkMultiples(contourList); // check if intersections agree on
t and point values | 710 bool hasM = checkMultiples(contourList); // check if intersections agree on
t and point values |
| 709 SkTDArray<SkOpSegment::AlignedSpan> aligned; | 711 SkTDArray<SkOpSegment::AlignedSpan> aligned; |
| 710 if (hasM) { | 712 if (hasM) { |
| 711 alignMultiples(contourList, &aligned); // align pairs of identical poin
ts | 713 alignMultiples(contourList, &aligned); // align pairs of identical poin
ts |
| 712 alignCoincidence(contourList, aligned); | 714 alignCoincidence(contourList, aligned); |
| 713 } | 715 } |
| 714 checkDuplicates(contourList); // check if spans have the same number on the
other end | 716 checkDuplicates(contourList); // check if spans have the same number on the
other end |
| 715 checkTiny(contourList); // if pair have the same end points, mark them as p
arallel | 717 checkTiny(contourList); // if pair have the same end points, mark them as p
arallel |
| 716 checkSmall(contourList); // a pair of curves with a small span may turn int
o coincident lines | 718 checkSmall(contourList); // a pair of curves with a small span may turn int
o coincident lines |
| 717 joinCoincidence(contourList); // join curves that connect to a coincident p
air | 719 joinCoincidence(contourList); // join curves that connect to a coincident p
air |
| 718 sortSegments(contourList); | 720 sortSegments(contourList); |
| 719 if (!calcAngles(contourList)) { | 721 if (!calcAngles(contourList)) { |
| 720 return false; | 722 return false; |
| 721 } | 723 } |
| 722 sortAngles(contourList); | 724 sortAngles(contourList); |
| 723 #if DEBUG_ACTIVE_SPANS || DEBUG_ACTIVE_SPANS_FIRST_ONLY | 725 #if DEBUG_ACTIVE_SPANS || DEBUG_ACTIVE_SPANS_FIRST_ONLY |
| 724 DebugShowActiveSpans(*contourList); | 726 DebugShowActiveSpans(*contourList); |
| 725 #endif | 727 #endif |
| 726 return true; | 728 return true; |
| 727 } | 729 } |
| OLD | NEW |