Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: tests/PathOpsConicIntersectionTest.cpp

Issue 2368993002: allow conic chop to fail (Closed)
Patch Set: address comment Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pathops/SkOpEdgeBuilder.cpp ('k') | tests/PathOpsOpTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/pathops/SkOpEdgeBuilder.cpp ('k') | tests/PathOpsOpTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698