| 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 29 matching lines...) Expand all Loading... |
| 40 *path = temp; | 40 *path = temp; |
| 41 } | 41 } |
| 42 path->setFillType(fillType); | 42 path->setFillType(fillType); |
| 43 return true; | 43 return true; |
| 44 } | 44 } |
| 45 SkChunkAlloc allocator(4096); | 45 SkChunkAlloc allocator(4096); |
| 46 SkOpContourHead contourHead; | 46 SkOpContourHead contourHead; |
| 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 builder.finish(); | 50 if (builder.unparseable() || !builder.finish()) { |
| 51 return false; |
| 52 } |
| 53 if (!contourHead.count()) { |
| 54 return true; |
| 55 } |
| 51 SkASSERT(contourHead.next()); | 56 SkASSERT(contourHead.next()); |
| 52 contourHead.resetReverse(); | 57 contourHead.resetReverse(); |
| 53 bool writePath = false; | 58 bool writePath = false; |
| 54 SkOpSpan* topSpan; | 59 SkOpSpan* topSpan; |
| 55 globalState.setPhase(SkOpGlobalState::kFixWinding); | 60 globalState.setPhase(SkOpGlobalState::kFixWinding); |
| 56 while ((topSpan = FindSortableTop(&contourHead))) { | 61 while ((topSpan = FindSortableTop(&contourHead))) { |
| 57 SkOpSegment* topSegment = topSpan->segment(); | 62 SkOpSegment* topSegment = topSpan->segment(); |
| 58 SkOpContour* topContour = topSegment->contour(); | 63 SkOpContour* topContour = topSegment->contour(); |
| 59 SkASSERT(topContour->isCcw() >= 0); | 64 SkASSERT(topContour->isCcw() >= 0); |
| 60 #if DEBUG_WINDING | 65 #if DEBUG_WINDING |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 sum.addPath(fPathRefs[index]); | 174 sum.addPath(fPathRefs[index]); |
| 170 } | 175 } |
| 171 } | 176 } |
| 172 reset(); | 177 reset(); |
| 173 bool success = Simplify(sum, result); | 178 bool success = Simplify(sum, result); |
| 174 if (!success) { | 179 if (!success) { |
| 175 *result = original; | 180 *result = original; |
| 176 } | 181 } |
| 177 return success; | 182 return success; |
| 178 } | 183 } |
| OLD | NEW |