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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 | 618 |
619 static void selfOneOff(skiatest::Reporter* reporter, int index) { | 619 static void selfOneOff(skiatest::Reporter* reporter, int index) { |
620 const SkDCubic& cubic = selfSet[index]; | 620 const SkDCubic& cubic = selfSet[index]; |
621 SkPoint c[4]; | 621 SkPoint c[4]; |
622 for (int i = 0; i < 4; ++i) { | 622 for (int i = 0; i < 4; ++i) { |
623 c[i] = cubic[i].asSkPoint(); | 623 c[i] = cubic[i].asSkPoint(); |
624 } | 624 } |
625 SkScalar loopT; | 625 SkScalar loopT; |
626 SkScalar d[3]; | 626 SkScalar d[3]; |
627 SkCubicType cubicType = SkClassifyCubic(c, d); | 627 SkCubicType cubicType = SkClassifyCubic(c, d); |
628 if (SkDCubic::ComplexBreak(c, &loopT) && cubicType == SkCubicType::kLoop_SkC
ubicType) { | 628 SkDCubic::CubicType dType; |
| 629 if (SkDCubic::ComplexBreak(c, &loopT, &dType) && cubicType == SkCubicType::k
Loop_SkCubicType) { |
629 SkIntersections i; | 630 SkIntersections i; |
630 SkPoint twoCubics[7]; | 631 SkPoint twoCubics[7]; |
631 SkChopCubicAt(c, twoCubics, loopT); | 632 SkChopCubicAt(c, twoCubics, loopT); |
632 SkDCubic chopped[2]; | 633 SkDCubic chopped[2]; |
633 chopped[0].set(&twoCubics[0]); | 634 chopped[0].set(&twoCubics[0]); |
634 chopped[1].set(&twoCubics[3]); | 635 chopped[1].set(&twoCubics[3]); |
635 int result = i.intersect(chopped[0], chopped[1]); | 636 int result = i.intersect(chopped[0], chopped[1]); |
636 REPORTER_ASSERT(reporter, result == 2); | 637 REPORTER_ASSERT(reporter, result == 2); |
637 REPORTER_ASSERT(reporter, i.used() == 2); | 638 REPORTER_ASSERT(reporter, i.used() == 2); |
638 for (int index = 0; index < result; ++index) { | 639 for (int index = 0; index < result; ++index) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 } | 689 } |
689 | 690 |
690 DEF_TEST(PathOpsCubicIntersection, reporter) { | 691 DEF_TEST(PathOpsCubicIntersection, reporter) { |
691 oneOffTests(reporter); | 692 oneOffTests(reporter); |
692 cubicIntersectionSelfTest(reporter); | 693 cubicIntersectionSelfTest(reporter); |
693 cubicIntersectionCoinTest(reporter); | 694 cubicIntersectionCoinTest(reporter); |
694 standardTestCases(reporter); | 695 standardTestCases(reporter); |
695 if (false) CubicIntersection_IntersectionFinder(); | 696 if (false) CubicIntersection_IntersectionFinder(); |
696 if (false) CubicIntersection_RandTest(reporter); | 697 if (false) CubicIntersection_RandTest(reporter); |
697 } | 698 } |
OLD | NEW |