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

Side by Side Diff: src/pathops/SkReduceOrder.cpp

Issue 633393002: harden pathops for pathological test (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: exclude new test that asserts in debug Created 6 years, 1 month 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/SkPathOpsTypes.h ('k') | tests/PathOpsBattles.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 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 "SkReduceOrder.h" 7 #include "SkReduceOrder.h"
8 8
9 int SkReduceOrder::reduce(const SkDLine& line) { 9 int SkReduceOrder::reduce(const SkDLine& line) {
10 fLine[0] = line[0]; 10 fLine[0] = line[0];
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 for (index = 0; index < 3; ++index) { 82 for (index = 0; index < 3; ++index) {
83 if (AlmostEqualUlps(quad[index].fX, quad[minX].fX)) { 83 if (AlmostEqualUlps(quad[index].fX, quad[minX].fX)) {
84 minXSet |= 1 << index; 84 minXSet |= 1 << index;
85 } 85 }
86 if (AlmostEqualUlps(quad[index].fY, quad[minY].fY)) { 86 if (AlmostEqualUlps(quad[index].fY, quad[minY].fY)) {
87 minYSet |= 1 << index; 87 minYSet |= 1 << index;
88 } 88 }
89 } 89 }
90 if (minXSet == 0x7) { // test for vertical line 90 if (minXSet == 0x7) { // test for vertical line
91 if (minYSet == 0x7) { // return 1 if all four are coincident 91 if (minYSet == 0x7) { // return 1 if all three are coincident
92 return coincident_line(quad, fQuad); 92 return coincident_line(quad, fQuad);
93 } 93 }
94 return vertical_line(quad, fQuad); 94 return vertical_line(quad, fQuad);
95 } 95 }
96 if (minYSet == 0xF) { // test for horizontal line 96 if (minYSet == 0x7) { // test for horizontal line
97 return horizontal_line(quad, fQuad); 97 return horizontal_line(quad, fQuad);
98 } 98 }
99 int result = check_linear(quad, minX, maxX, minY, maxY, fQuad); 99 int result = check_linear(quad, minX, maxX, minY, maxY, fQuad);
100 if (result) { 100 if (result) {
101 return result; 101 return result;
102 } 102 }
103 fQuad = quad; 103 fQuad = quad;
104 return 3; 104 return 3;
105 } 105 }
106 106
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 cubic.set(a); 276 cubic.set(a);
277 SkReduceOrder reducer; 277 SkReduceOrder reducer;
278 int order = reducer.reduce(cubic, kAllow_Quadratics); 278 int order = reducer.reduce(cubic, kAllow_Quadratics);
279 if (order == 2 || order == 3) { // cubic became line or quad 279 if (order == 2 || order == 3) { // cubic became line or quad
280 for (int index = 0; index < order; ++index) { 280 for (int index = 0; index < order; ++index) {
281 *reducePts++ = reducer.fQuad[index].asSkPoint(); 281 *reducePts++ = reducer.fQuad[index].asSkPoint();
282 } 282 }
283 } 283 }
284 return SkPathOpsPointsToVerb(order - 1); 284 return SkPathOpsPointsToVerb(order - 1);
285 } 285 }
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsTypes.h ('k') | tests/PathOpsBattles.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698