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 | 7 |
8 #include "SkIntersections.h" | 8 #include "SkIntersections.h" |
9 #include "SkPathOpsCubic.h" | 9 #include "SkPathOpsCubic.h" |
10 #include "SkPathOpsLine.h" | 10 #include "SkPathOpsLine.h" |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 SkASSERT(!selfIntersect); | 487 SkASSERT(!selfIntersect); |
488 return fUsed; | 488 return fUsed; |
489 } | 489 } |
490 // FIXME: pass in cached bounds from caller | 490 // FIXME: pass in cached bounds from caller |
491 SkDRect c2Bounds; | 491 SkDRect c2Bounds; |
492 c2Bounds.setBounds(c2); | 492 c2Bounds.setBounds(c2); |
493 if (!(exactEndBits & 4)) { | 493 if (!(exactEndBits & 4)) { |
494 cubicNearEnd(c1, false, c2, c2Bounds); | 494 cubicNearEnd(c1, false, c2, c2Bounds); |
495 } | 495 } |
496 if (!(exactEndBits & 8)) { | 496 if (!(exactEndBits & 8)) { |
| 497 if (selfIntersect && fUsed) { |
| 498 return fUsed; |
| 499 } |
497 cubicNearEnd(c1, true, c2, c2Bounds); | 500 cubicNearEnd(c1, true, c2, c2Bounds); |
| 501 if (selfIntersect && fUsed && ((approximately_less_than_zero(fT[0][0]) |
| 502 && approximately_less_than_zero(fT[1][0])) |
| 503 || (approximately_greater_than_one(fT[0][0]) |
| 504 && approximately_greater_than_one(fT[1][0])))) { |
| 505 SkASSERT(fUsed == 1); |
| 506 fUsed = 0; |
| 507 return fUsed; |
| 508 } |
498 } | 509 } |
499 if (!selfIntersect) { | 510 if (!selfIntersect) { |
500 SkDRect c1Bounds; | 511 SkDRect c1Bounds; |
501 c1Bounds.setBounds(c1); // OPTIMIZE use setRawBounds ? | 512 c1Bounds.setBounds(c1); // OPTIMIZE use setRawBounds ? |
502 swap(); | 513 swap(); |
503 if (!(exactEndBits & 1)) { | 514 if (!(exactEndBits & 1)) { |
504 cubicNearEnd(c2, false, c1, c1Bounds); | 515 cubicNearEnd(c2, false, c1, c1Bounds); |
505 } | 516 } |
506 if (!(exactEndBits & 2)) { | 517 if (!(exactEndBits & 2)) { |
507 cubicNearEnd(c2, true, c1, c1Bounds); | 518 cubicNearEnd(c2, true, c1, c1Bounds); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 } | 652 } |
642 (void) intersect(c, c); | 653 (void) intersect(c, c); |
643 if (used() > 0) { | 654 if (used() > 0) { |
644 SkASSERT(used() == 1); | 655 SkASSERT(used() == 1); |
645 if (fT[0][0] > fT[1][0]) { | 656 if (fT[0][0] > fT[1][0]) { |
646 swapPts(); | 657 swapPts(); |
647 } | 658 } |
648 } | 659 } |
649 return used(); | 660 return used(); |
650 } | 661 } |
OLD | NEW |