| 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 "SkPathOpsBounds.h" | 9 #include "SkPathOpsBounds.h" |
| 10 | 10 |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 SkOpPtT* coinPtT[2]; | 503 SkOpPtT* coinPtT[2]; |
| 504 for (int pt = 0; pt < pts; ++pt) { | 504 for (int pt = 0; pt < pts; ++pt) { |
| 505 SkASSERT(ts[0][pt] >= 0 && ts[0][pt] <= 1); | 505 SkASSERT(ts[0][pt] >= 0 && ts[0][pt] <= 1); |
| 506 SkASSERT(ts[1][pt] >= 0 && ts[1][pt] <= 1); | 506 SkASSERT(ts[1][pt] >= 0 && ts[1][pt] <= 1); |
| 507 wt.segment()->debugValidate(); | 507 wt.segment()->debugValidate(); |
| 508 SkOpPtT* testTAt = wt.segment()->addT(ts[swap][pt]); | 508 SkOpPtT* testTAt = wt.segment()->addT(ts[swap][pt]); |
| 509 wn.segment()->debugValidate(); | 509 wn.segment()->debugValidate(); |
| 510 SkOpPtT* nextTAt = wn.segment()->addT(ts[!swap][pt]); | 510 SkOpPtT* nextTAt = wn.segment()->addT(ts[!swap][pt]); |
| 511 if (!testTAt->contains(nextTAt)) { | 511 if (!testTAt->contains(nextTAt)) { |
| 512 SkOpPtT* oppPrev = testTAt->oppPrev(nextTAt); // Returns n
ullptr if pair | 512 SkOpPtT* oppPrev = testTAt->oppPrev(nextTAt); // Returns n
ullptr if pair |
| 513 if (oppPrev) { // already s
hares a pt-t loop. | 513 if (oppPrev) { // already s
hare a pt-t loop. |
| 514 testTAt->span()->mergeMatches(nextTAt->span()); | 514 testTAt->span()->mergeMatches(nextTAt->span()); |
| 515 testTAt->addOpp(nextTAt, oppPrev); | 515 testTAt->addOpp(nextTAt, oppPrev); |
| 516 } | 516 } |
| 517 if (testTAt->fPt != nextTAt->fPt) { | 517 if (testTAt->fPt != nextTAt->fPt) { |
| 518 testTAt->span()->unaligned(); | 518 testTAt->span()->unaligned(); |
| 519 nextTAt->span()->unaligned(); | 519 nextTAt->span()->unaligned(); |
| 520 } | 520 } |
| 521 wt.segment()->debugValidate(); | 521 wt.segment()->debugValidate(); |
| 522 wn.segment()->debugValidate(); | 522 wn.segment()->debugValidate(); |
| 523 } | 523 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 536 } | 536 } |
| 537 if (coinPtT[1]->span() == nextTAt->span()) { | 537 if (coinPtT[1]->span() == nextTAt->span()) { |
| 538 coinIndex = -1; // coincidence span collapsed | 538 coinIndex = -1; // coincidence span collapsed |
| 539 continue; | 539 continue; |
| 540 } | 540 } |
| 541 if (swap) { | 541 if (swap) { |
| 542 SkTSwap(coinPtT[0], coinPtT[1]); | 542 SkTSwap(coinPtT[0], coinPtT[1]); |
| 543 SkTSwap(testTAt, nextTAt); | 543 SkTSwap(testTAt, nextTAt); |
| 544 } | 544 } |
| 545 SkASSERT(coinPtT[0]->span()->t() < testTAt->span()->t()); | 545 SkASSERT(coinPtT[0]->span()->t() < testTAt->span()->t()); |
| 546 if (coinPtT[0]->span()->deleted()) { |
| 547 coinIndex = -1; |
| 548 continue; |
| 549 } |
| 550 if (testTAt->span()->deleted()) { |
| 551 coinIndex = -1; |
| 552 continue; |
| 553 } |
| 546 coincidence->add(coinPtT[0], testTAt, coinPtT[1], nextTAt); | 554 coincidence->add(coinPtT[0], testTAt, coinPtT[1], nextTAt); |
| 547 wt.segment()->debugValidate(); | 555 wt.segment()->debugValidate(); |
| 548 wn.segment()->debugValidate(); | 556 wn.segment()->debugValidate(); |
| 549 coinIndex = -1; | 557 coinIndex = -1; |
| 550 } | 558 } |
| 551 SkASSERT(coinIndex < 0); // expect coincidence to be paired | 559 SkASSERT(coinIndex < 0); // expect coincidence to be paired |
| 552 } while (wn.advance()); | 560 } while (wn.advance()); |
| 553 } while (wt.advance()); | 561 } while (wt.advance()); |
| 554 return true; | 562 return true; |
| 555 } | 563 } |
| OLD | NEW |