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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 #if DEBUG_ACTIVE_SPANS | 198 #if DEBUG_ACTIVE_SPANS |
199 void DebugShowActiveSpans(SkTDArray<SkOpContour* >& contourList) { | 199 void DebugShowActiveSpans(SkTDArray<SkOpContour* >& contourList) { |
200 int index; | 200 int index; |
201 for (index = 0; index < contourList.count(); ++ index) { | 201 for (index = 0; index < contourList.count(); ++ index) { |
202 contourList[index]->debugShowActiveSpans(); | 202 contourList[index]->debugShowActiveSpans(); |
203 } | 203 } |
204 } | 204 } |
205 #endif | 205 #endif |
206 | 206 |
207 static SkOpSegment* findTopSegment(const SkTDArray<SkOpContour* >& contourList, | 207 static SkOpSegment* findTopSegment(const SkTDArray<SkOpContour* >& contourList, |
208 bool firstPass, SkOpSpanBase** start, SkOpSpanBase** end, SkPoint* topLe
ft, | 208 bool firstPass, SkOpSpanBase** start, SkOpSpanBase** end, SkDPoint* topL
eft, |
209 bool* unsortable, bool* done, SkChunkAlloc* allocator) { | 209 bool* unsortable, bool* done, SkChunkAlloc* allocator) { |
210 SkOpSegment* result; | 210 SkOpSegment* result; |
211 const SkOpSegment* lastTopStart = NULL; | 211 const SkOpSegment* lastTopStart = NULL; |
212 SkOpSpanBase* lastStart = NULL, * lastEnd = NULL; | 212 SkOpSpanBase* lastStart = NULL, * lastEnd = NULL; |
213 do { | 213 do { |
214 SkPoint bestXY = {SK_ScalarMax, SK_ScalarMax}; | 214 SkDPoint bestXY = {SK_ScalarMax, SK_ScalarMax}; |
215 int contourCount = contourList.count(); | 215 int contourCount = contourList.count(); |
216 SkOpSegment* topStart = NULL; | 216 SkOpSegment* topStart = NULL; |
217 *done = true; | 217 *done = true; |
218 for (int cIndex = 0; cIndex < contourCount; ++cIndex) { | 218 for (int cIndex = 0; cIndex < contourCount; ++cIndex) { |
219 SkOpContour* contour = contourList[cIndex]; | 219 SkOpContour* contour = contourList[cIndex]; |
220 if (contour->done()) { | 220 if (contour->done()) { |
221 continue; | 221 continue; |
222 } | 222 } |
223 const SkPathOpsBounds& bounds = contour->bounds(); | 223 const SkPathOpsBounds& bounds = contour->bounds(); |
224 if (bounds.fBottom < topLeft->fY) { | 224 if (bounds.fBottom < topLeft->fY) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 return; | 293 return; |
294 } | 294 } |
295 | 295 |
296 struct SortableTop2 { // error if local in pre-C++11 | 296 struct SortableTop2 { // error if local in pre-C++11 |
297 SkOpSpanBase* fStart; | 297 SkOpSpanBase* fStart; |
298 SkOpSpanBase* fEnd; | 298 SkOpSpanBase* fEnd; |
299 }; | 299 }; |
300 | 300 |
301 SkOpSegment* FindSortableTop(const SkTDArray<SkOpContour* >& contourList, bool f
irstPass, | 301 SkOpSegment* FindSortableTop(const SkTDArray<SkOpContour* >& contourList, bool f
irstPass, |
302 SkOpAngle::IncludeType angleIncludeType, bool* firstContour, SkOpSpanBas
e** startPtr, | 302 SkOpAngle::IncludeType angleIncludeType, bool* firstContour, SkOpSpanBas
e** startPtr, |
303 SkOpSpanBase** endPtr, SkPoint* topLeft, bool* unsortable, bool* done, b
ool* onlyVertical, | 303 SkOpSpanBase** endPtr, SkDPoint* topLeft, bool* unsortable, bool* done,
bool* onlyVertical, |
304 SkChunkAlloc* allocator) { | 304 SkChunkAlloc* allocator) { |
305 SkOpSegment* current = findTopSegment(contourList, firstPass, startPtr, endP
tr, topLeft, | 305 SkOpSegment* current = findTopSegment(contourList, firstPass, startPtr, endP
tr, topLeft, |
306 unsortable, done, allocator); | 306 unsortable, done, allocator); |
307 if (!current) { | 307 if (!current) { |
308 return NULL; | 308 return NULL; |
309 } | 309 } |
310 SkOpSpanBase* start = *startPtr; | 310 SkOpSpanBase* start = *startPtr; |
311 SkOpSpanBase* end = *endPtr; | 311 SkOpSpanBase* end = *endPtr; |
312 SkASSERT(current == start->segment()); | 312 SkASSERT(current == start->segment()); |
313 if (*firstContour) { | 313 if (*firstContour) { |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 missingCoincidence(contourList, coincidence, allocator); | 718 missingCoincidence(contourList, coincidence, allocator); |
719 if (!coincidence->apply()) { | 719 if (!coincidence->apply()) { |
720 return false; | 720 return false; |
721 } | 721 } |
722 } | 722 } |
723 #if DEBUG_ACTIVE_SPANS | 723 #if DEBUG_ACTIVE_SPANS |
724 DebugShowActiveSpans(*contourList); | 724 DebugShowActiveSpans(*contourList); |
725 #endif | 725 #endif |
726 return true; | 726 return true; |
727 } | 727 } |
OLD | NEW |