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 "SkPathPriv.h" | 10 #include "SkPathPriv.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 SkOpGlobalState globalState(&contourHead, &allocator SkDEBUGPARAMS(false) | 47 SkOpGlobalState globalState(&contourHead, &allocator SkDEBUGPARAMS(false) |
48 SkDEBUGPARAMS(nullptr)); | 48 SkDEBUGPARAMS(nullptr)); |
49 SkOpEdgeBuilder builder(*path, &contourHead, &globalState); | 49 SkOpEdgeBuilder builder(*path, &contourHead, &globalState); |
50 if (builder.unparseable() || !builder.finish()) { | 50 if (builder.unparseable() || !builder.finish()) { |
51 return false; | 51 return false; |
52 } | 52 } |
53 if (!contourHead.count()) { | 53 if (!contourHead.count()) { |
54 return true; | 54 return true; |
55 } | 55 } |
56 SkASSERT(contourHead.next()); | 56 SkASSERT(contourHead.next()); |
| 57 contourHead.joinAllSegments(); |
57 contourHead.resetReverse(); | 58 contourHead.resetReverse(); |
58 bool writePath = false; | 59 bool writePath = false; |
59 SkOpSpan* topSpan; | 60 SkOpSpan* topSpan; |
60 globalState.setPhase(SkOpGlobalState::kFixWinding); | 61 globalState.setPhase(SkOpGlobalState::kFixWinding); |
61 while ((topSpan = FindSortableTop(&contourHead))) { | 62 while ((topSpan = FindSortableTop(&contourHead))) { |
62 SkOpSegment* topSegment = topSpan->segment(); | 63 SkOpSegment* topSegment = topSpan->segment(); |
63 SkOpContour* topContour = topSegment->contour(); | 64 SkOpContour* topContour = topSegment->contour(); |
64 SkASSERT(topContour->isCcw() >= 0); | 65 SkASSERT(topContour->isCcw() >= 0); |
65 #if DEBUG_WINDING | 66 #if DEBUG_WINDING |
66 SkDebugf("%s id=%d nested=%d ccw=%d\n", __FUNCTION__, | 67 SkDebugf("%s id=%d nested=%d ccw=%d\n", __FUNCTION__, |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 sum.addPath(fPathRefs[index]); | 175 sum.addPath(fPathRefs[index]); |
175 } | 176 } |
176 } | 177 } |
177 reset(); | 178 reset(); |
178 bool success = Simplify(sum, result); | 179 bool success = Simplify(sum, result); |
179 if (!success) { | 180 if (!success) { |
180 *result = original; | 181 *result = original; |
181 } | 182 } |
182 return success; | 183 return success; |
183 } | 184 } |
OLD | NEW |