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 "SkOpCoincidence.h" | 8 #include "SkOpCoincidence.h" |
9 #include "SkOpEdgeBuilder.h" | 9 #include "SkOpEdgeBuilder.h" |
10 #include "SkPathOpsCommon.h" | 10 #include "SkPathOpsCommon.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 104 } |
105 SkASSERT(unsortable || !current->done()); | 105 SkASSERT(unsortable || !current->done()); |
106 SkOpSpanBase* nextStart = start; | 106 SkOpSpanBase* nextStart = start; |
107 SkOpSpanBase* nextEnd = end; | 107 SkOpSpanBase* nextEnd = end; |
108 SkOpSegment* next = current->findNextOp(&chase, &nextStart,
&nextEnd, | 108 SkOpSegment* next = current->findNextOp(&chase, &nextStart,
&nextEnd, |
109 &unsortable, op, xorMask, xorOpMask); | 109 &unsortable, op, xorMask, xorOpMask); |
110 if (!next) { | 110 if (!next) { |
111 if (!unsortable && simple->hasMove() | 111 if (!unsortable && simple->hasMove() |
112 && current->verb() != SkPath::kLine_Verb | 112 && current->verb() != SkPath::kLine_Verb |
113 && !simple->isClosed()) { | 113 && !simple->isClosed()) { |
114 current->addCurveTo(start, end, simple, true); | 114 if (!current->addCurveTo(start, end, simple)) { |
| 115 return false; |
| 116 } |
115 #if DEBUG_ACTIVE_SPANS | 117 #if DEBUG_ACTIVE_SPANS |
116 if (!simple->isClosed()) { | 118 if (!simple->isClosed()) { |
117 DebugShowActiveSpans(contourList); | 119 DebugShowActiveSpans(contourList); |
118 } | 120 } |
119 #endif | 121 #endif |
120 } | 122 } |
121 break; | 123 break; |
122 } | 124 } |
123 #if DEBUG_FLOW | 125 #if DEBUG_FLOW |
124 SkDebugf("%s current id=%d from=(%1.9g,%1.9g) to=(%1.9g,%1.9
g)\n", __FUNCTION__, | 126 SkDebugf("%s current id=%d from=(%1.9g,%1.9g) to=(%1.9g,%1.9
g)\n", __FUNCTION__, |
125 current->debugID(), start->pt().fX, start->pt().fY, | 127 current->debugID(), start->pt().fX, start->pt().fY, |
126 end->pt().fX, end->pt().fY); | 128 end->pt().fX, end->pt().fY); |
127 #endif | 129 #endif |
128 current->addCurveTo(start, end, simple, true); | 130 if (!current->addCurveTo(start, end, simple)) { |
| 131 return false; |
| 132 } |
129 current = next; | 133 current = next; |
130 start = nextStart; | 134 start = nextStart; |
131 end = nextEnd; | 135 end = nextEnd; |
132 } while (!simple->isClosed() && (!unsortable || !start->starter(
end)->done())); | 136 } while (!simple->isClosed() && (!unsortable || !start->starter(
end)->done())); |
133 if (current->activeWinding(start, end) && !simple->isClosed()) { | 137 if (current->activeWinding(start, end) && !simple->isClosed()) { |
134 SkOpSpan* spanStart = start->starter(end); | 138 SkOpSpan* spanStart = start->starter(end); |
135 if (!spanStart->done()) { | 139 if (!spanStart->done()) { |
136 current->addCurveTo(start, end, simple, true); | 140 if (!current->addCurveTo(start, end, simple)) { |
| 141 return false; |
| 142 } |
137 current->markDone(spanStart); | 143 current->markDone(spanStart); |
138 } | 144 } |
139 } | 145 } |
140 simple->close(); | 146 simple->close(); |
141 } else { | 147 } else { |
142 SkOpSpanBase* last = current->markAndChaseDone(start, end); | 148 SkOpSpanBase* last = current->markAndChaseDone(start, end); |
143 if (last && !last->chased()) { | 149 if (last && !last->chased()) { |
144 last->setChased(true); | 150 last->setChased(true); |
145 SkASSERT(!SkPathOpsDebug::ChaseContains(chase, last)); | 151 SkASSERT(!SkPathOpsDebug::ChaseContains(chase, last)); |
146 *chase.append() = last; | 152 *chase.append() = last; |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 one.dumpHex(); | 450 one.dumpHex(); |
445 SkDebugf("two: fill=%d\n", two.getFillType()); | 451 SkDebugf("two: fill=%d\n", two.getFillType()); |
446 two.dumpHex(); | 452 two.dumpHex(); |
447 SkASSERT(0); | 453 SkASSERT(0); |
448 } | 454 } |
449 return true; | 455 return true; |
450 #else | 456 #else |
451 return OpDebug(one, two, op, result, true SkDEBUGPARAMS(nullptr)); | 457 return OpDebug(one, two, op, result, true SkDEBUGPARAMS(nullptr)); |
452 #endif | 458 #endif |
453 } | 459 } |
OLD | NEW |