| 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 "SkPathOpsBounds.h" | 8 #include "SkPathOpsBounds.h" |
| 9 | 9 |
| 10 #if DEBUG_ADD_INTERSECTING_TS | 10 #if DEBUG_ADD_INTERSECTING_TS |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 ts.cleanUpCoincidence(); // prefer (t == 0 or t ==
1) | 390 ts.cleanUpCoincidence(); // prefer (t == 0 or t ==
1) |
| 391 pts = 1; | 391 pts = 1; |
| 392 } | 392 } |
| 393 } | 393 } |
| 394 } | 394 } |
| 395 } | 395 } |
| 396 for (int pt = 0; pt < pts; ++pt) { | 396 for (int pt = 0; pt < pts; ++pt) { |
| 397 SkASSERT(ts[0][pt] >= 0 && ts[0][pt] <= 1); | 397 SkASSERT(ts[0][pt] >= 0 && ts[0][pt] <= 1); |
| 398 SkASSERT(ts[1][pt] >= 0 && ts[1][pt] <= 1); | 398 SkASSERT(ts[1][pt] >= 0 && ts[1][pt] <= 1); |
| 399 SkPoint point = ts.pt(pt).asSkPoint(); | 399 SkPoint point = ts.pt(pt).asSkPoint(); |
| 400 wt.alignTPt(wn, swap, pt, &ts, &point); |
| 400 int testTAt = wt.addT(wn, point, ts[swap][pt]); | 401 int testTAt = wt.addT(wn, point, ts[swap][pt]); |
| 401 int nextTAt = wn.addT(wt, point, ts[!swap][pt]); | 402 int nextTAt = wn.addT(wt, point, ts[!swap][pt]); |
| 402 wt.addOtherT(testTAt, ts[!swap][pt], nextTAt); | 403 wt.addOtherT(testTAt, ts[!swap][pt], nextTAt); |
| 403 wn.addOtherT(nextTAt, ts[swap][pt], testTAt); | 404 wn.addOtherT(nextTAt, ts[swap][pt], testTAt); |
| 404 } | 405 } |
| 405 } while (wn.advance()); | 406 } while (wn.advance()); |
| 406 } while (wt.advance()); | 407 } while (wt.advance()); |
| 407 return true; | 408 return true; |
| 408 } | 409 } |
| 409 | 410 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 430 wt.addOtherT(nextTAt, ts[0][0], testTAt); | 431 wt.addOtherT(nextTAt, ts[0][0], testTAt); |
| 431 } while (wt.advance()); | 432 } while (wt.advance()); |
| 432 } | 433 } |
| 433 | 434 |
| 434 // resolve any coincident pairs found while intersecting, and | 435 // resolve any coincident pairs found while intersecting, and |
| 435 // see if coincidence is formed by clipping non-concident segments | 436 // see if coincidence is formed by clipping non-concident segments |
| 436 void CoincidenceCheck(SkTArray<SkOpContour*, true>* contourList, int total) { | 437 void CoincidenceCheck(SkTArray<SkOpContour*, true>* contourList, int total) { |
| 437 int contourCount = (*contourList).count(); | 438 int contourCount = (*contourList).count(); |
| 438 for (int cIndex = 0; cIndex < contourCount; ++cIndex) { | 439 for (int cIndex = 0; cIndex < contourCount; ++cIndex) { |
| 439 SkOpContour* contour = (*contourList)[cIndex]; | 440 SkOpContour* contour = (*contourList)[cIndex]; |
| 441 contour->resolveNearCoincidence(); |
| 442 } |
| 443 for (int cIndex = 0; cIndex < contourCount; ++cIndex) { |
| 444 SkOpContour* contour = (*contourList)[cIndex]; |
| 440 contour->addCoincidentPoints(); | 445 contour->addCoincidentPoints(); |
| 441 } | 446 } |
| 442 for (int cIndex = 0; cIndex < contourCount; ++cIndex) { | 447 for (int cIndex = 0; cIndex < contourCount; ++cIndex) { |
| 443 SkOpContour* contour = (*contourList)[cIndex]; | 448 SkOpContour* contour = (*contourList)[cIndex]; |
| 444 contour->calcCoincidentWinding(); | 449 contour->calcCoincidentWinding(); |
| 445 } | 450 } |
| 446 for (int cIndex = 0; cIndex < contourCount; ++cIndex) { | 451 for (int cIndex = 0; cIndex < contourCount; ++cIndex) { |
| 447 SkOpContour* contour = (*contourList)[cIndex]; | 452 SkOpContour* contour = (*contourList)[cIndex]; |
| 448 contour->calcPartialCoincidentWinding(); | 453 contour->calcPartialCoincidentWinding(); |
| 449 } | 454 } |
| 450 } | 455 } |
| OLD | NEW |