| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 SkASSERT(coin); | 78 SkASSERT(coin); |
| 79 do { | 79 do { |
| 80 SkOpPtT* startPtT = coin->fCoinPtTStart; | 80 SkOpPtT* startPtT = coin->fCoinPtTStart; |
| 81 SkOpPtT* oStartPtT = coin->fOppPtTStart; | 81 SkOpPtT* oStartPtT = coin->fOppPtTStart; |
| 82 SkASSERT(startPtT->contains(oStartPtT)); | 82 SkASSERT(startPtT->contains(oStartPtT)); |
| 83 SkASSERT(coin->fCoinPtTEnd->contains(coin->fOppPtTEnd)); | 83 SkASSERT(coin->fCoinPtTEnd->contains(coin->fOppPtTEnd)); |
| 84 SkOpSpanBase* start = startPtT->span(); | 84 SkOpSpanBase* start = startPtT->span(); |
| 85 SkOpSpanBase* oStart = oStartPtT->span(); | 85 SkOpSpanBase* oStart = oStartPtT->span(); |
| 86 const SkOpSpanBase* end = coin->fCoinPtTEnd->span(); | 86 const SkOpSpanBase* end = coin->fCoinPtTEnd->span(); |
| 87 const SkOpSpanBase* oEnd = coin->fOppPtTEnd->span(); | 87 const SkOpSpanBase* oEnd = coin->fOppPtTEnd->span(); |
| 88 if (oEnd->deleted()) { |
| 89 return false; |
| 90 } |
| 88 SkOpSpanBase* test = start->upCast()->next(); | 91 SkOpSpanBase* test = start->upCast()->next(); |
| 89 SkOpSpanBase* oTest = coin->fFlipped ? oStart->prev() : oStart->upCast()
->next(); | 92 SkOpSpanBase* oTest = coin->fFlipped ? oStart->prev() : oStart->upCast()
->next(); |
| 90 while (test != end || oTest != oEnd) { | 93 while (test != end || oTest != oEnd) { |
| 91 if (!test->ptT()->contains(oTest->ptT())) { | 94 if (!test->ptT()->contains(oTest->ptT())) { |
| 92 // use t ranges to guess which one is missing | 95 // use t ranges to guess which one is missing |
| 93 double startRange = coin->fCoinPtTEnd->fT - startPtT->fT; | 96 double startRange = coin->fCoinPtTEnd->fT - startPtT->fT; |
| 94 if (!startRange) { | 97 if (!startRange) { |
| 95 return false; | 98 return false; |
| 96 } | 99 } |
| 97 double startPart = (test->t() - startPtT->fT) / startRange; | 100 double startPart = (test->t() - startPtT->fT) / startRange; |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 *overS = SkTMax(SkTMin(coin1s->fT, coin1e->fT), SkTMin(coin2s->fT, coin2e->f
T)); | 667 *overS = SkTMax(SkTMin(coin1s->fT, coin1e->fT), SkTMin(coin2s->fT, coin2e->f
T)); |
| 665 *overE = SkTMin(SkTMax(coin1s->fT, coin1e->fT), SkTMax(coin2s->fT, coin2e->f
T)); | 668 *overE = SkTMin(SkTMax(coin1s->fT, coin1e->fT), SkTMax(coin2s->fT, coin2e->f
T)); |
| 666 return *overS < *overE; | 669 return *overS < *overE; |
| 667 } | 670 } |
| 668 | 671 |
| 669 bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, const S
kOpPtT* testS, | 672 bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, const S
kOpPtT* testS, |
| 670 const SkOpPtT* testE) const { | 673 const SkOpPtT* testE) const { |
| 671 return testS->segment()->testForCoincidence(testS, testE, testS->span(), | 674 return testS->segment()->testForCoincidence(testS, testE, testS->span(), |
| 672 testE->span(), outer->fCoinPtTStart->segment(), 120000); // FIXME:
replace with tuned | 675 testE->span(), outer->fCoinPtTStart->segment(), 120000); // FIXME:
replace with tuned |
| 673 } | 676 } |
| OLD | NEW |