| 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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 #endif | 501 #endif |
| 502 int coinIndex = -1; | 502 int coinIndex = -1; |
| 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 SkOpPtT* oppPrev = testTAt->oppPrev(nextTAt); | 511 if (!testTAt->contains(nextTAt)) { |
| 512 if (oppPrev) { | 512 SkOpPtT* oppPrev = testTAt->oppPrev(nextTAt); // Returns n
ullptr if pair |
| 513 testTAt->addOpp(nextTAt, oppPrev); | 513 if (oppPrev) { // already s
hares a pt-t loop. |
| 514 testTAt->span()->mergeMatches(nextTAt->span()); |
| 515 testTAt->addOpp(nextTAt, oppPrev); |
| 516 } |
| 517 if (testTAt->fPt != nextTAt->fPt) { |
| 518 testTAt->span()->unaligned(); |
| 519 nextTAt->span()->unaligned(); |
| 520 } |
| 521 wt.segment()->debugValidate(); |
| 522 wn.segment()->debugValidate(); |
| 514 } | 523 } |
| 515 if (testTAt->fPt != nextTAt->fPt) { | |
| 516 testTAt->span()->unaligned(); | |
| 517 nextTAt->span()->unaligned(); | |
| 518 } | |
| 519 wt.segment()->debugValidate(); | |
| 520 wn.segment()->debugValidate(); | |
| 521 if (!ts.isCoincident(pt)) { | 524 if (!ts.isCoincident(pt)) { |
| 522 continue; | 525 continue; |
| 523 } | 526 } |
| 524 if (coinIndex < 0) { | 527 if (coinIndex < 0) { |
| 525 coinPtT[0] = testTAt; | 528 coinPtT[0] = testTAt; |
| 526 coinPtT[1] = nextTAt; | 529 coinPtT[1] = nextTAt; |
| 527 coinIndex = pt; | 530 coinIndex = pt; |
| 528 continue; | 531 continue; |
| 529 } | 532 } |
| 530 if (coinPtT[0]->span() == testTAt->span()) { | 533 if (coinPtT[0]->span() == testTAt->span()) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 543 coincidence->add(coinPtT[0], testTAt, coinPtT[1], nextTAt); | 546 coincidence->add(coinPtT[0], testTAt, coinPtT[1], nextTAt); |
| 544 wt.segment()->debugValidate(); | 547 wt.segment()->debugValidate(); |
| 545 wn.segment()->debugValidate(); | 548 wn.segment()->debugValidate(); |
| 546 coinIndex = -1; | 549 coinIndex = -1; |
| 547 } | 550 } |
| 548 SkASSERT(coinIndex < 0); // expect coincidence to be paired | 551 SkASSERT(coinIndex < 0); // expect coincidence to be paired |
| 549 } while (wn.advance()); | 552 } while (wn.advance()); |
| 550 } while (wt.advance()); | 553 } while (wt.advance()); |
| 551 return true; | 554 return true; |
| 552 } | 555 } |
| OLD | NEW |