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 "PathOpsCubicIntersectionTestData.h" | 7 #include "PathOpsCubicIntersectionTestData.h" |
8 #include "PathOpsTestCommon.h" | 8 #include "PathOpsTestCommon.h" |
9 #include "SkGeometry.h" | 9 #include "SkGeometry.h" |
10 #include "SkIntersections.h" | 10 #include "SkIntersections.h" |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 | 620 |
621 static void selfOneOff(skiatest::Reporter* reporter, int index) { | 621 static void selfOneOff(skiatest::Reporter* reporter, int index) { |
622 const SkDCubic& cubic = selfSet[index]; | 622 const SkDCubic& cubic = selfSet[index]; |
623 SkPoint c[4]; | 623 SkPoint c[4]; |
624 for (int i = 0; i < 4; ++i) { | 624 for (int i = 0; i < 4; ++i) { |
625 c[i] = cubic[i].asSkPoint(); | 625 c[i] = cubic[i].asSkPoint(); |
626 } | 626 } |
627 SkScalar loopT; | 627 SkScalar loopT; |
628 SkScalar d[3]; | 628 SkScalar d[3]; |
629 SkCubicType cubicType = SkClassifyCubic(c, d); | 629 SkCubicType cubicType = SkClassifyCubic(c, d); |
630 SkDCubic::CubicType dType; | 630 if (SkDCubic::ComplexBreak(c, &loopT) && cubicType == SkCubicType::kLoop_SkC
ubicType) { |
631 if (SkDCubic::ComplexBreak(c, &loopT, &dType) && cubicType == SkCubicType::k
Loop_SkCubicType) { | |
632 SkIntersections i; | 631 SkIntersections i; |
633 SkPoint twoCubics[7]; | 632 SkPoint twoCubics[7]; |
634 SkChopCubicAt(c, twoCubics, loopT); | 633 SkChopCubicAt(c, twoCubics, loopT); |
635 SkDCubic chopped[2]; | 634 SkDCubic chopped[2]; |
636 chopped[0].set(&twoCubics[0]); | 635 chopped[0].set(&twoCubics[0]); |
637 chopped[1].set(&twoCubics[3]); | 636 chopped[1].set(&twoCubics[3]); |
638 int result = i.intersect(chopped[0], chopped[1]); | 637 int result = i.intersect(chopped[0], chopped[1]); |
639 REPORTER_ASSERT(reporter, result == 2); | 638 REPORTER_ASSERT(reporter, result == 2); |
640 REPORTER_ASSERT(reporter, i.used() == 2); | 639 REPORTER_ASSERT(reporter, i.used() == 2); |
641 for (int index = 0; index < result; ++index) { | 640 for (int index = 0; index < result; ++index) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 } | 695 } |
697 | 696 |
698 DEF_TEST(PathOpsCubicIntersection, reporter) { | 697 DEF_TEST(PathOpsCubicIntersection, reporter) { |
699 oneOffTests(reporter); | 698 oneOffTests(reporter); |
700 cubicIntersectionSelfTest(reporter); | 699 cubicIntersectionSelfTest(reporter); |
701 cubicIntersectionCoinTest(reporter); | 700 cubicIntersectionCoinTest(reporter); |
702 standardTestCases(reporter); | 701 standardTestCases(reporter); |
703 if (false) CubicIntersection_IntersectionFinder(); | 702 if (false) CubicIntersection_IntersectionFinder(); |
704 if (false) CubicIntersection_RandTest(reporter); | 703 if (false) CubicIntersection_RandTest(reporter); |
705 } | 704 } |
OLD | NEW |