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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 end = coin->coinPtTEnd()->span(); | 474 end = coin->coinPtTEnd()->span(); |
475 oEnd = coin->oppPtTEnd()->span(); | 475 oEnd = coin->oppPtTEnd()->span(); |
476 } | 476 } |
477 if (test != end) { | 477 if (test != end) { |
478 FAIL_IF(!test->upCastable()); | 478 FAIL_IF(!test->upCastable()); |
479 priorT = test->t(); | 479 priorT = test->t(); |
480 test = test->upCast()->next(); | 480 test = test->upCast()->next(); |
481 } | 481 } |
482 if (oTest != oEnd) { | 482 if (oTest != oEnd) { |
483 oPriorT = oTest->t(); | 483 oPriorT = oTest->t(); |
484 oTest = coin->flipped() ? oTest->prev() : oTest->upCast()->next(
); | 484 if (coin->flipped()) { |
| 485 oTest = oTest->prev(); |
| 486 } else { |
| 487 FAIL_IF(!oTest->upCastable()); |
| 488 oTest = oTest->upCast()->next(); |
| 489 } |
485 FAIL_IF(!oTest); | 490 FAIL_IF(!oTest); |
486 } | 491 } |
487 | 492 |
488 } | 493 } |
489 } while ((coin = coin->next())); | 494 } while ((coin = coin->next())); |
490 return true; | 495 return true; |
491 } | 496 } |
492 | 497 |
493 // given a t span, map the same range on the coincident span | 498 // given a t span, map the same range on the coincident span |
494 /* | 499 /* |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 return true; | 862 return true; |
858 } | 863 } |
859 } | 864 } |
860 const SkOpPtT* s2 = overS->find(seg2); | 865 const SkOpPtT* s2 = overS->find(seg2); |
861 const SkOpPtT* e2 = overE->find(seg2); | 866 const SkOpPtT* e2 = overE->find(seg2); |
862 FAIL_IF(!e2); | 867 FAIL_IF(!e2); |
863 if (!s2->starter(e2)->span()->upCast()->windValue()) { | 868 if (!s2->starter(e2)->span()->upCast()->windValue()) { |
864 s2 = overS->find(seg2o); | 869 s2 = overS->find(seg2o); |
865 e2 = overE->find(seg2o); | 870 e2 = overE->find(seg2o); |
866 FAIL_IF(!s2); | 871 FAIL_IF(!s2); |
| 872 FAIL_IF(!e2); |
867 if (!s2->starter(e2)->span()->upCast()->windValue()) { | 873 if (!s2->starter(e2)->span()->upCast()->windValue()) { |
868 return true; | 874 return true; |
869 } | 875 } |
870 } | 876 } |
871 if (s1->segment() == s2->segment()) { | 877 if (s1->segment() == s2->segment()) { |
872 return true; | 878 return true; |
873 } | 879 } |
874 if (s1->fT > e1->fT) { | 880 if (s1->fT > e1->fT) { |
875 SkTSwap(s1, e1); | 881 SkTSwap(s1, e1); |
876 SkTSwap(s2, e2); | 882 SkTSwap(s2, e2); |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 const SkOpSegment* oSegment = oStart->segment(); | 1305 const SkOpSegment* oSegment = oStart->segment(); |
1300 SkOpSpanBase* next = start; | 1306 SkOpSpanBase* next = start; |
1301 SkOpSpanBase* oNext = oStart; | 1307 SkOpSpanBase* oNext = oStart; |
1302 bool ordered; | 1308 bool ordered; |
1303 FAIL_IF(!coin->ordered(&ordered)); | 1309 FAIL_IF(!coin->ordered(&ordered)); |
1304 while ((next = next->upCast()->next()) != end) { | 1310 while ((next = next->upCast()->next()) != end) { |
1305 FAIL_IF(!next->upCastable()); | 1311 FAIL_IF(!next->upCastable()); |
1306 SkAssertResult(next->upCast()->insertCoincidence(oSegment, flipped,
ordered)); | 1312 SkAssertResult(next->upCast()->insertCoincidence(oSegment, flipped,
ordered)); |
1307 } | 1313 } |
1308 while ((oNext = oNext->upCast()->next()) != oEnd) { | 1314 while ((oNext = oNext->upCast()->next()) != oEnd) { |
| 1315 FAIL_IF(!oNext->upCastable()); |
1309 FAIL_IF(!oNext->upCast()->insertCoincidence(segment, flipped, ordere
d)); | 1316 FAIL_IF(!oNext->upCast()->insertCoincidence(segment, flipped, ordere
d)); |
1310 } | 1317 } |
1311 } while ((coin = coin->next())); | 1318 } while ((coin = coin->next())); |
1312 return true; | 1319 return true; |
1313 } | 1320 } |
1314 | 1321 |
1315 // Please keep in sync with debugMarkCollapsed() | 1322 // Please keep in sync with debugMarkCollapsed() |
1316 void SkOpCoincidence::markCollapsed(SkCoincidentSpans* coin, SkOpPtT* test) { | 1323 void SkOpCoincidence::markCollapsed(SkCoincidentSpans* coin, SkOpPtT* test) { |
1317 SkCoincidentSpans* head = coin; | 1324 SkCoincidentSpans* head = coin; |
1318 while (coin) { | 1325 while (coin) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1374 } | 1381 } |
1375 do { | 1382 do { |
1376 if (coin->coinPtTStart()->segment() == deleted | 1383 if (coin->coinPtTStart()->segment() == deleted |
1377 || coin->coinPtTEnd()->segment() == deleted | 1384 || coin->coinPtTEnd()->segment() == deleted |
1378 || coin->oppPtTStart()->segment() == deleted | 1385 || coin->oppPtTStart()->segment() == deleted |
1379 || coin->oppPtTEnd()->segment() == deleted) { | 1386 || coin->oppPtTEnd()->segment() == deleted) { |
1380 this->release(fHead, coin); | 1387 this->release(fHead, coin); |
1381 } | 1388 } |
1382 } while ((coin = coin->next())); | 1389 } while ((coin = coin->next())); |
1383 } | 1390 } |
OLD | NEW |