OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkIntersections.h" | 7 #include "SkIntersections.h" |
8 #include "SkTDArray.h" | 8 #include "SkTDArray.h" |
9 #include "Test.h" | 9 #include "Test.h" |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 const TestSet& testSet = testSets[index]; | 42 const TestSet& testSet = testSets[index]; |
43 int testCount = testSet.testCount; | 43 int testCount = testSet.testCount; |
44 SkASSERT(testCount > 1); | 44 SkASSERT(testCount > 1); |
45 SkTDArray<SkIntersections> combos; | 45 SkTDArray<SkIntersections> combos; |
46 for (int outer = 0; outer < testCount - 1; ++outer) { | 46 for (int outer = 0; outer < testCount - 1; ++outer) { |
47 const Curve& oTest = testSet.tests[outer]; | 47 const Curve& oTest = testSet.tests[outer]; |
48 for (int inner = outer + 1; inner < testCount; ++inner) { | 48 for (int inner = outer + 1; inner < testCount; ++inner) { |
49 const Curve& iTest = testSet.tests[inner]; | 49 const Curve& iTest = testSet.tests[inner]; |
50 SkIntersections* i = combos.append(); | 50 SkIntersections* i = combos.append(); |
51 sk_bzero(i, sizeof(SkIntersections)); | 51 sk_bzero(i, sizeof(SkIntersections)); |
52 SkDLine oLine = {{ oTest.curve[0], oTest.curve[1] }}; | |
53 SkDLine iLine = {{ iTest.curve[0], iTest.curve[1] }}; | |
54 if (oTest.ptCount == 1 && iTest.ptCount == 1) { | 52 if (oTest.ptCount == 1 && iTest.ptCount == 1) { |
55 i->intersect(oLine, iLine); | 53 i->intersect(*(const SkDLine*) &oTest.curve, *(const SkDLine*) &
iTest.curve); |
56 } else if (oTest.ptCount == 1 && iTest.ptCount == 4) { | 54 } else if (oTest.ptCount == 1 && iTest.ptCount == 4) { |
57 i->intersect(iTest.curve, oLine); | 55 i->intersect(iTest.curve, *(const SkDLine*) &oTest.curve); |
58 } else if (oTest.ptCount == 4 && iTest.ptCount == 1) { | 56 } else if (oTest.ptCount == 4 && iTest.ptCount == 1) { |
59 i->intersect(oTest.curve, iLine); | 57 i->intersect(oTest.curve, *(const SkDLine*) &oTest.curve); |
60 } else if (oTest.ptCount == 4 && iTest.ptCount == 4) { | 58 } else if (oTest.ptCount == 4 && iTest.ptCount == 4) { |
61 i->intersect(oTest.curve, iTest.curve); | 59 i->intersectB(oTest.curve, iTest.curve); |
62 } else { | 60 } else { |
63 SkASSERT(0); | 61 SkASSERT(0); |
64 } | 62 } |
65 // i->dump(); | 63 // i->dump(); |
66 } | 64 } |
67 } | 65 } |
68 } | 66 } |
69 | 67 |
70 DEF_TEST(PathOpsThreeWay, reporter) { | 68 DEF_TEST(PathOpsThreeWay, reporter) { |
71 for (int index = 0; index < testSetsCount; ++index) { | 69 for (int index = 0; index < testSetsCount; ++index) { |
72 testSetTest(reporter, index); | 70 testSetTest(reporter, index); |
73 reporter->bumpTestCount(); | 71 reporter->bumpTestCount(); |
74 } | 72 } |
75 } | 73 } |
76 | 74 |
77 DEF_TEST(PathOpsThreeWayOneOff, reporter) { | 75 DEF_TEST(PathOpsThreeWayOneOff, reporter) { |
78 int index = 1; | 76 int index = 1; |
79 testSetTest(reporter, index); | 77 testSetTest(reporter, index); |
80 } | 78 } |
OLD | NEW |