OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkOpCoincidence.h" | 7 #include "SkOpCoincidence.h" |
8 #include "SkOpSegment.h" | 8 #include "SkOpSegment.h" |
9 #include "SkPathOpsTSect.h" | 9 #include "SkPathOpsTSect.h" |
10 | 10 |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 if (coin->fCoinPtTEnd->deleted()) { | 561 if (coin->fCoinPtTEnd->deleted()) { |
562 coin->fCoinPtTEnd = coin->fCoinPtTEnd->doppelganger(); | 562 coin->fCoinPtTEnd = coin->fCoinPtTEnd->doppelganger(); |
563 } | 563 } |
564 if (coin->fOppPtTStart->deleted()) { | 564 if (coin->fOppPtTStart->deleted()) { |
565 coin->fOppPtTStart = coin->fOppPtTStart->doppelganger(); | 565 coin->fOppPtTStart = coin->fOppPtTStart->doppelganger(); |
566 } | 566 } |
567 if (coin->fOppPtTEnd->deleted()) { | 567 if (coin->fOppPtTEnd->deleted()) { |
568 coin->fOppPtTEnd = coin->fOppPtTEnd->doppelganger(); | 568 coin->fOppPtTEnd = coin->fOppPtTEnd->doppelganger(); |
569 } | 569 } |
570 } while ((coin = coin->fNext)); | 570 } while ((coin = coin->fNext)); |
| 571 coin = fHead; |
| 572 SkCoincidentSpans** priorPtr = &fHead; |
| 573 do { |
| 574 if (coin->fCoinPtTStart->collapsed(coin->fCoinPtTEnd) |
| 575 || coin->fOppPtTStart->collapsed(coin->fOppPtTEnd)) { |
| 576 *priorPtr = coin->fNext; |
| 577 continue; |
| 578 } |
| 579 priorPtr = &coin->fNext; |
| 580 } while ((coin = coin->fNext)); |
571 } | 581 } |
572 | 582 |
573 void SkOpCoincidence::fixUp(SkOpPtT* deleted, SkOpPtT* kept) { | 583 void SkOpCoincidence::fixUp(SkOpPtT* deleted, SkOpPtT* kept) { |
574 SkCoincidentSpans* coin = fHead; | 584 SkCoincidentSpans* coin = fHead; |
575 if (!coin) { | 585 if (!coin) { |
576 return; | 586 return; |
577 } | 587 } |
578 do { | 588 do { |
579 if (coin->fCoinPtTStart == deleted) { | 589 if (coin->fCoinPtTStart == deleted) { |
580 if (coin->fCoinPtTEnd->span() == kept->span()) { | 590 if (coin->fCoinPtTEnd->span() == kept->span()) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 *overS = SkTMax(SkTMin(coin1s->fT, coin1e->fT), SkTMin(coin2s->fT, coin2e->f
T)); | 660 *overS = SkTMax(SkTMin(coin1s->fT, coin1e->fT), SkTMin(coin2s->fT, coin2e->f
T)); |
651 *overE = SkTMin(SkTMax(coin1s->fT, coin1e->fT), SkTMax(coin2s->fT, coin2e->f
T)); | 661 *overE = SkTMin(SkTMax(coin1s->fT, coin1e->fT), SkTMax(coin2s->fT, coin2e->f
T)); |
652 return *overS < *overE; | 662 return *overS < *overE; |
653 } | 663 } |
654 | 664 |
655 bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, SkOpPtT
* testS, | 665 bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, SkOpPtT
* testS, |
656 SkOpPtT* testE) const { | 666 SkOpPtT* testE) const { |
657 return testS->segment()->testForCoincidence(testS, testE, testS->span(), | 667 return testS->segment()->testForCoincidence(testS, testE, testS->span(), |
658 testE->span(), outer->fCoinPtTStart->segment(), 120000); // FIXME:
replace with tuned | 668 testE->span(), outer->fCoinPtTStart->segment(), 120000); // FIXME:
replace with tuned |
659 } | 669 } |
OLD | NEW |