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 "PathOpsExtendedTest.h" | 7 #include "PathOpsExtendedTest.h" |
8 #include "PathOpsTestCommon.h" | 8 #include "PathOpsTestCommon.h" |
| 9 #include "SkGeometry.h" |
9 #include "SkIntersections.h" | 10 #include "SkIntersections.h" |
10 #include "SkPathOpsConic.h" | 11 #include "SkPathOpsConic.h" |
11 #include "SkPathOpsLine.h" | 12 #include "SkPathOpsLine.h" |
12 #include "SkReduceOrder.h" | 13 #include "SkReduceOrder.h" |
13 #include "Test.h" | 14 #include "Test.h" |
14 | 15 |
15 static struct lineConic { | 16 static struct lineConic { |
16 SkDConic conic; | 17 SkDConic conic; |
17 SkDLine line; | 18 SkDLine line; |
18 int result; | 19 int result; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 for (size_t index = 0; index < lineConicTests_count; ++index) { | 97 for (size_t index = 0; index < lineConicTests_count; ++index) { |
97 int iIndex = static_cast<int>(index); | 98 int iIndex = static_cast<int>(index); |
98 const SkDConic& conic = lineConicTests[index].conic; | 99 const SkDConic& conic = lineConicTests[index].conic; |
99 SkASSERT(ValidConic(conic)); | 100 SkASSERT(ValidConic(conic)); |
100 const SkDLine& line = lineConicTests[index].line; | 101 const SkDLine& line = lineConicTests[index].line; |
101 SkASSERT(ValidLine(line)); | 102 SkASSERT(ValidLine(line)); |
102 SkReduceOrder reducer; | 103 SkReduceOrder reducer; |
103 SkPoint pts[3] = { conic.fPts.fPts[0].asSkPoint(), conic.fPts.fPts[1].as
SkPoint(), | 104 SkPoint pts[3] = { conic.fPts.fPts[0].asSkPoint(), conic.fPts.fPts[1].as
SkPoint(), |
104 conic.fPts.fPts[2].asSkPoint() }; | 105 conic.fPts.fPts[2].asSkPoint() }; |
105 SkPoint reduced[3]; | 106 SkPoint reduced[3]; |
106 SkPath::Verb order1 = SkReduceOrder::Conic(pts, conic.fWeight, reduced); | 107 SkConic floatConic; |
| 108 floatConic.set(pts, conic.fWeight); |
| 109 SkPath::Verb order1 = SkReduceOrder::Conic(floatConic, reduced); |
107 if (order1 != SkPath::kConic_Verb) { | 110 if (order1 != SkPath::kConic_Verb) { |
108 SkDebugf("%s [%d] conic verb=%d\n", __FUNCTION__, iIndex, order1); | 111 SkDebugf("%s [%d] conic verb=%d\n", __FUNCTION__, iIndex, order1); |
109 REPORTER_ASSERT(reporter, 0); | 112 REPORTER_ASSERT(reporter, 0); |
110 } | 113 } |
111 int order2 = reducer.reduce(line); | 114 int order2 = reducer.reduce(line); |
112 if (order2 < 2) { | 115 if (order2 < 2) { |
113 SkDebugf("%s [%d] line order=%d\n", __FUNCTION__, iIndex, order2); | 116 SkDebugf("%s [%d] line order=%d\n", __FUNCTION__, iIndex, order2); |
114 REPORTER_ASSERT(reporter, 0); | 117 REPORTER_ASSERT(reporter, 0); |
115 } | 118 } |
116 SkIntersections intersections; | 119 SkIntersections intersections; |
(...skipping 17 matching lines...) Expand all Loading... |
134 } | 137 } |
135 if (!t1.approximatelyEqual(lineConicTests[index].expected[0]) | 138 if (!t1.approximatelyEqual(lineConicTests[index].expected[0]) |
136 && (lineConicTests[index].result == 1 | 139 && (lineConicTests[index].result == 1 |
137 || !t1.approximatelyEqual(lineConicTests[index].expected[1])
)) { | 140 || !t1.approximatelyEqual(lineConicTests[index].expected[1])
)) { |
138 SkDebugf("%s t1=(%1.9g,%1.9g)\n", __FUNCTION__, t1.fX, t1.fY); | 141 SkDebugf("%s t1=(%1.9g,%1.9g)\n", __FUNCTION__, t1.fX, t1.fY); |
139 REPORTER_ASSERT(reporter, 0); | 142 REPORTER_ASSERT(reporter, 0); |
140 } | 143 } |
141 } | 144 } |
142 } | 145 } |
143 } | 146 } |
OLD | NEW |