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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 } | 228 } |
229 | 229 |
230 static void move_nearby(SkOpContourHead* contourList DEBUG_COIN_DECLARE_PARAMS(
)) { | 230 static void move_nearby(SkOpContourHead* contourList DEBUG_COIN_DECLARE_PARAMS(
)) { |
231 DEBUG_STATIC_SET_PHASE(contourList); | 231 DEBUG_STATIC_SET_PHASE(contourList); |
232 SkOpContour* contour = contourList; | 232 SkOpContour* contour = contourList; |
233 do { | 233 do { |
234 contour->moveNearby(); | 234 contour->moveNearby(); |
235 } while ((contour = contour->next())); | 235 } while ((contour = contour->next())); |
236 } | 236 } |
237 | 237 |
238 static void sort_angles(SkOpContourHead* contourList) { | 238 static bool sort_angles(SkOpContourHead* contourList) { |
239 SkOpContour* contour = contourList; | 239 SkOpContour* contour = contourList; |
240 do { | 240 do { |
241 contour->sortAngles(); | 241 if (!contour->sortAngles()) { |
| 242 return false; |
| 243 } |
242 } while ((contour = contour->next())); | 244 } while ((contour = contour->next())); |
| 245 return true; |
243 } | 246 } |
244 | 247 |
245 bool HandleCoincidence(SkOpContourHead* contourList, SkOpCoincidence* coincidenc
e) { | 248 bool HandleCoincidence(SkOpContourHead* contourList, SkOpCoincidence* coincidenc
e) { |
246 SkOpGlobalState* globalState = contourList->globalState(); | 249 SkOpGlobalState* globalState = contourList->globalState(); |
247 // match up points within the coincident runs | 250 // match up points within the coincident runs |
248 if (!coincidence->addExpanded(DEBUG_PHASE_ONLY_PARAMS(kIntersecting))) { | 251 if (!coincidence->addExpanded(DEBUG_PHASE_ONLY_PARAMS(kIntersecting))) { |
249 return false; | 252 return false; |
250 } | 253 } |
251 // combine t values when multiple intersections occur on some segments but n
ot others | 254 // combine t values when multiple intersections occur on some segments but n
ot others |
252 if (!move_multiples(contourList DEBUG_PHASE_PARAMS(kWalking))) { | 255 if (!move_multiples(contourList DEBUG_PHASE_PARAMS(kWalking))) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 // are different, construct a new pair to resolve their mutual span | 323 // are different, construct a new pair to resolve their mutual span |
321 if (!pairs->findOverlaps(&overlaps DEBUG_ITER_PARAMS(SAFETY_COUNT - saf
etyHatch))) { | 324 if (!pairs->findOverlaps(&overlaps DEBUG_ITER_PARAMS(SAFETY_COUNT - saf
etyHatch))) { |
322 return false; | 325 return false; |
323 } | 326 } |
324 if (!--safetyHatch) { | 327 if (!--safetyHatch) { |
325 SkASSERT(globalState->debugSkipAssert()); | 328 SkASSERT(globalState->debugSkipAssert()); |
326 return false; | 329 return false; |
327 } | 330 } |
328 } while (!overlaps.isEmpty()); | 331 } while (!overlaps.isEmpty()); |
329 calc_angles(contourList DEBUG_COIN_PARAMS()); | 332 calc_angles(contourList DEBUG_COIN_PARAMS()); |
330 sort_angles(contourList); | 333 if (!sort_angles(contourList)) { |
| 334 return false; |
| 335 } |
331 #if DEBUG_COINCIDENCE_VERBOSE | 336 #if DEBUG_COINCIDENCE_VERBOSE |
332 coincidence->debugShowCoincidence(); | 337 coincidence->debugShowCoincidence(); |
333 #endif | 338 #endif |
334 #if DEBUG_COINCIDENCE | 339 #if DEBUG_COINCIDENCE |
335 coincidence->debugValidate(); | 340 coincidence->debugValidate(); |
336 #endif | 341 #endif |
337 SkPathOpsDebug::ShowActiveSpans(contourList); | 342 SkPathOpsDebug::ShowActiveSpans(contourList); |
338 return true; | 343 return true; |
339 } | 344 } |
OLD | NEW |