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

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

Issue 1037573004: cumulative pathops patch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix pathopsinverse gm Created 5 years, 9 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/SkReduceOrder.h ('k') | tests/PathOpsAngleIdeas.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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 int order = reducer.reduce(quad); 265 int order = reducer.reduce(quad);
266 if (order == 2) { // quad became line 266 if (order == 2) { // quad became line
267 for (int index = 0; index < order; ++index) { 267 for (int index = 0; index < order; ++index) {
268 *reducePts++ = reducer.fLine[index].asSkPoint(); 268 *reducePts++ = reducer.fLine[index].asSkPoint();
269 } 269 }
270 } 270 }
271 return SkPathOpsPointsToVerb(order - 1); 271 return SkPathOpsPointsToVerb(order - 1);
272 } 272 }
273 273
274 SkPath::Verb SkReduceOrder::Cubic(const SkPoint a[4], SkPoint* reducePts) { 274 SkPath::Verb SkReduceOrder::Cubic(const SkPoint a[4], SkPoint* reducePts) {
275 if (SkDPoint::ApproximatelyEqual(a[0], a[1]) && SkDPoint::ApproximatelyEqual (a[0], a[2])
276 && SkDPoint::ApproximatelyEqual(a[0], a[3])) {
277 reducePts[0] = a[0];
278 return SkPath::kMove_Verb;
279 }
275 SkDCubic cubic; 280 SkDCubic cubic;
276 cubic.set(a); 281 cubic.set(a);
277 SkReduceOrder reducer; 282 SkReduceOrder reducer;
278 int order = reducer.reduce(cubic, kAllow_Quadratics); 283 int order = reducer.reduce(cubic, kAllow_Quadratics);
279 if (order == 2 || order == 3) { // cubic became line or quad 284 if (order == 2 || order == 3) { // cubic became line or quad
280 for (int index = 0; index < order; ++index) { 285 for (int index = 0; index < order; ++index) {
281 *reducePts++ = reducer.fQuad[index].asSkPoint(); 286 *reducePts++ = reducer.fQuad[index].asSkPoint();
282 } 287 }
283 } 288 }
284 return SkPathOpsPointsToVerb(order - 1); 289 return SkPathOpsPointsToVerb(order - 1);
285 } 290 }
OLDNEW
« no previous file with comments | « src/pathops/SkReduceOrder.h ('k') | tests/PathOpsAngleIdeas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698