OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkGeometry.h" | 8 #include "SkGeometry.h" |
9 #include "SkIntersections.h" | 9 #include "SkIntersections.h" |
10 #include "Test.h" | 10 #include "Test.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 #endif | 158 #endif |
159 | 159 |
160 static void chopBothWays(const SkDConic& dConic, double t, const char* name) { | 160 static void chopBothWays(const SkDConic& dConic, double t, const char* name) { |
161 SkConic conic; | 161 SkConic conic; |
162 for (int index = 0; index < 3; ++index) { | 162 for (int index = 0; index < 3; ++index) { |
163 conic.fPts[index] = dConic.fPts[index].asSkPoint(); | 163 conic.fPts[index] = dConic.fPts[index].asSkPoint(); |
164 } | 164 } |
165 conic.fW = dConic.fWeight; | 165 conic.fW = dConic.fWeight; |
166 SkConic chopped[2]; | 166 SkConic chopped[2]; |
167 SkDConic dChopped[2]; | 167 SkDConic dChopped[2]; |
168 conic.chopAt(SkDoubleToScalar(t), chopped); | 168 if (!conic.chopAt(SkDoubleToScalar(t), chopped)) { |
| 169 return; |
| 170 } |
169 dChopped[0] = dConic.subDivide(0, t); | 171 dChopped[0] = dConic.subDivide(0, t); |
170 dChopped[1] = dConic.subDivide(t, 1); | 172 dChopped[1] = dConic.subDivide(t, 1); |
171 #if DEBUG_VISUALIZE_CONICS | 173 #if DEBUG_VISUALIZE_CONICS |
172 dConic.dump(); | 174 dConic.dump(); |
173 #endif | 175 #endif |
174 chopCompare(chopped, dChopped); | 176 chopCompare(chopped, dChopped); |
175 #if DEBUG_VISUALIZE_CONICS | 177 #if DEBUG_VISUALIZE_CONICS |
176 writePng(conic, chopped, name); | 178 writePng(conic, chopped, name); |
177 #endif | 179 #endif |
178 } | 180 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 } | 343 } |
342 } | 344 } |
343 | 345 |
344 DEF_TEST(PathOpsConicIntersectionOneOff, reporter) { | 346 DEF_TEST(PathOpsConicIntersectionOneOff, reporter) { |
345 oneOff(reporter, 0, 1); | 347 oneOff(reporter, 0, 1); |
346 } | 348 } |
347 | 349 |
348 DEF_TEST(PathOpsConicIntersection, reporter) { | 350 DEF_TEST(PathOpsConicIntersection, reporter) { |
349 oneOffTests(reporter); | 351 oneOffTests(reporter); |
350 } | 352 } |
OLD | NEW |