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] }}; |
52 if (oTest.ptCount == 1 && iTest.ptCount == 1) { | 54 if (oTest.ptCount == 1 && iTest.ptCount == 1) { |
53 i->intersect(*(const SkDLine*) &oTest.curve, *(const SkDLine*) &
iTest.curve); | 55 i->intersect(oLine, iLine); |
54 } else if (oTest.ptCount == 1 && iTest.ptCount == 4) { | 56 } else if (oTest.ptCount == 1 && iTest.ptCount == 4) { |
55 i->intersect(iTest.curve, *(const SkDLine*) &oTest.curve); | 57 i->intersect(iTest.curve, oLine); |
56 } else if (oTest.ptCount == 4 && iTest.ptCount == 1) { | 58 } else if (oTest.ptCount == 4 && iTest.ptCount == 1) { |
57 i->intersect(oTest.curve, *(const SkDLine*) &oTest.curve); | 59 i->intersect(oTest.curve, iLine); |
58 } else if (oTest.ptCount == 4 && iTest.ptCount == 4) { | 60 } else if (oTest.ptCount == 4 && iTest.ptCount == 4) { |
59 i->intersectB(oTest.curve, iTest.curve); | 61 i->intersect(oTest.curve, iTest.curve); |
60 } else { | 62 } else { |
61 SkASSERT(0); | 63 SkASSERT(0); |
62 } | 64 } |
63 // i->dump(); | 65 // i->dump(); |
64 } | 66 } |
65 } | 67 } |
66 } | 68 } |
67 | 69 |
68 DEF_TEST(PathOpsThreeWay, reporter) { | 70 DEF_TEST(PathOpsThreeWay, reporter) { |
69 for (int index = 0; index < testSetsCount; ++index) { | 71 for (int index = 0; index < testSetsCount; ++index) { |
70 testSetTest(reporter, index); | 72 testSetTest(reporter, index); |
71 reporter->bumpTestCount(); | 73 reporter->bumpTestCount(); |
72 } | 74 } |
73 } | 75 } |
74 | 76 |
75 DEF_TEST(PathOpsThreeWayOneOff, reporter) { | 77 DEF_TEST(PathOpsThreeWayOneOff, reporter) { |
76 int index = 1; | 78 int index = 1; |
77 testSetTest(reporter, index); | 79 testSetTest(reporter, index); |
78 } | 80 } |
OLD | NEW |