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 "PathOpsTestCommon.h" | 7 #include "PathOpsTestCommon.h" |
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 static const size_t lineCubicTests_count = SK_ARRAY_COUNT(lineCubicTests); | 43 static const size_t lineCubicTests_count = SK_ARRAY_COUNT(lineCubicTests); |
44 | 44 |
45 static void testOne(skiatest::Reporter* reporter, int iIndex) { | 45 static void testOne(skiatest::Reporter* reporter, int iIndex) { |
46 const SkDCubic& cubic = lineCubicTests[iIndex].cubic; | 46 const SkDCubic& cubic = lineCubicTests[iIndex].cubic; |
47 SkASSERT(ValidCubic(cubic)); | 47 SkASSERT(ValidCubic(cubic)); |
48 const SkDLine& line = lineCubicTests[iIndex].line; | 48 const SkDLine& line = lineCubicTests[iIndex].line; |
49 SkASSERT(ValidLine(line)); | 49 SkASSERT(ValidLine(line)); |
50 SkReduceOrder reduce1; | 50 SkReduceOrder reduce1; |
51 SkReduceOrder reduce2; | 51 SkReduceOrder reduce2; |
52 int order1 = reduce1.reduce(cubic, SkReduceOrder::kNo_Quadratics, | 52 int order1 = reduce1.reduce(cubic, SkReduceOrder::kNo_Quadratics); |
53 SkReduceOrder::kFill_Style); | |
54 int order2 = reduce2.reduce(line); | 53 int order2 = reduce2.reduce(line); |
55 if (order1 < 4) { | 54 if (order1 < 4) { |
56 SkDebugf("[%d] cubic order=%d\n", iIndex, order1); | 55 SkDebugf("[%d] cubic order=%d\n", iIndex, order1); |
57 REPORTER_ASSERT(reporter, 0); | 56 REPORTER_ASSERT(reporter, 0); |
58 } | 57 } |
59 if (order2 < 2) { | 58 if (order2 < 2) { |
60 SkDebugf("[%d] line order=%d\n", iIndex, order2); | 59 SkDebugf("[%d] line order=%d\n", iIndex, order2); |
61 REPORTER_ASSERT(reporter, 0); | 60 REPORTER_ASSERT(reporter, 0); |
62 } | 61 } |
63 if (order1 == 4 && order2 == 2) { | 62 if (order1 == 4 && order2 == 2) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", i.pt(0).fX, i.pt(0).fY, nextL.
fX, nextL.fY); | 106 SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", i.pt(0).fX, i.pt(0).fY, nextL.
fX, nextL.fY); |
108 SkDebugf("prevD=%1.9g dist=%1.9g nextD=%1.9g\n", prev.distance(nextL), | 107 SkDebugf("prevD=%1.9g dist=%1.9g nextD=%1.9g\n", prev.distance(nextL), |
109 sect.distance(i.pt(0)), cubic[3].distance(prevL)); | 108 sect.distance(i.pt(0)), cubic[3].distance(prevL)); |
110 #endif | 109 #endif |
111 } | 110 } |
112 | 111 |
113 #include "TestClassDef.h" | 112 #include "TestClassDef.h" |
114 DEFINE_TESTCLASS_SHORT(PathOpsCubicLineIntersectionTest) | 113 DEFINE_TESTCLASS_SHORT(PathOpsCubicLineIntersectionTest) |
115 | 114 |
116 DEFINE_TESTCLASS_SHORT(PathOpsCubicLineIntersectionOneOffTest) | 115 DEFINE_TESTCLASS_SHORT(PathOpsCubicLineIntersectionOneOffTest) |
OLD | NEW |