OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 | 7 |
8 #include "SkMatrix.h" | 8 #include "SkMatrix.h" |
9 #include "SkOpEdgeBuilder.h" | 9 #include "SkOpEdgeBuilder.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 SkOpEdgeBuilder builder(*path, &contourHead, &allocator, &globalState); | 48 SkOpEdgeBuilder builder(*path, &contourHead, &allocator, &globalState); |
49 builder.finish(&allocator); | 49 builder.finish(&allocator); |
50 SkASSERT(contourHead.next()); | 50 SkASSERT(contourHead.next()); |
51 contourHead.resetReverse(); | 51 contourHead.resetReverse(); |
52 bool writePath = false; | 52 bool writePath = false; |
53 SkOpSpan* topSpan; | 53 SkOpSpan* topSpan; |
54 globalState.setPhase(SkOpGlobalState::kFixWinding); | 54 globalState.setPhase(SkOpGlobalState::kFixWinding); |
55 while ((topSpan = FindSortableTop(&contourHead))) { | 55 while ((topSpan = FindSortableTop(&contourHead))) { |
56 SkOpSegment* topSegment = topSpan->segment(); | 56 SkOpSegment* topSegment = topSpan->segment(); |
57 SkOpContour* topContour = topSegment->contour(); | 57 SkOpContour* topContour = topSegment->contour(); |
58 bool active = topSegment->activeWinding(topSpan, topSpan->next()); | |
59 SkASSERT(topContour->isCcw() >= 0); | 58 SkASSERT(topContour->isCcw() >= 0); |
60 if (active != SkToBool(topContour->isCcw())) { | 59 #if DEBUG_WINDING |
| 60 SkDebugf("%s id=%d nested=%d ccw=%d\n", __FUNCTION__, |
| 61 topSegment->debugID(), globalState.nested(), topContour->isCcw()
); |
| 62 #endif |
| 63 if ((globalState.nested() & 1) != SkToBool(topContour->isCcw())) { |
61 topContour->setReverse(); | 64 topContour->setReverse(); |
62 writePath = true; | 65 writePath = true; |
63 } | 66 } |
64 topContour->markDone(); | 67 topContour->markDone(); |
| 68 globalState.clearNested(); |
65 } | 69 } |
66 if (!writePath) { | 70 if (!writePath) { |
67 path->setFillType(fillType); | 71 path->setFillType(fillType); |
68 return; | 72 return; |
69 } | 73 } |
70 SkPath empty; | 74 SkPath empty; |
71 SkPathWriter woundPath(empty); | 75 SkPathWriter woundPath(empty); |
72 SkOpContour* test = &contourHead; | 76 SkOpContour* test = &contourHead; |
73 do { | 77 do { |
74 if (test->reversed()) { | 78 if (test->reversed()) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 FixWinding(&fPathRefs[index]); | 162 FixWinding(&fPathRefs[index]); |
159 sum.addPath(fPathRefs[index]); | 163 sum.addPath(fPathRefs[index]); |
160 } | 164 } |
161 reset(); | 165 reset(); |
162 bool success = Simplify(sum, result); | 166 bool success = Simplify(sum, result); |
163 if (!success) { | 167 if (!success) { |
164 *result = original; | 168 *result = original; |
165 } | 169 } |
166 return success; | 170 return success; |
167 } | 171 } |
OLD | NEW |