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

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

Issue 19543005: turn off debugging printfs (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: remove unused code Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/pathops/SkPathOpsCubic.h ('k') | src/pathops/SkPathOpsCurve.h » ('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 "SkLineParameters.h" 7 #include "SkLineParameters.h"
8 #include "SkPathOpsCubic.h" 8 #include "SkPathOpsCubic.h"
9 #include "SkPathOpsLine.h" 9 #include "SkPathOpsLine.h"
10 #include "SkPathOpsQuad.h" 10 #include "SkPathOpsQuad.h"
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 SkDCubic sub = subDivide(startT, endT); 297 SkDCubic sub = subDivide(startT, endT);
298 SkDPoint topPt = sub[0]; 298 SkDPoint topPt = sub[0];
299 if (topPt.fY > sub[3].fY || (topPt.fY == sub[3].fY && topPt.fX > sub[3].fX)) { 299 if (topPt.fY > sub[3].fY || (topPt.fY == sub[3].fY && topPt.fX > sub[3].fX)) {
300 topPt = sub[3]; 300 topPt = sub[3];
301 } 301 }
302 double extremeTs[2]; 302 double extremeTs[2];
303 if (!sub.monotonicInY()) { 303 if (!sub.monotonicInY()) {
304 int roots = FindExtrema(sub[0].fY, sub[1].fY, sub[2].fY, sub[3].fY, extr emeTs); 304 int roots = FindExtrema(sub[0].fY, sub[1].fY, sub[2].fY, sub[3].fY, extr emeTs);
305 for (int index = 0; index < roots; ++index) { 305 for (int index = 0; index < roots; ++index) {
306 double t = startT + (endT - startT) * extremeTs[index]; 306 double t = startT + (endT - startT) * extremeTs[index];
307 SkDPoint mid = xyAtT(t); 307 SkDPoint mid = ptAtT(t);
308 if (topPt.fY > mid.fY || (topPt.fY == mid.fY && topPt.fX > mid.fX)) { 308 if (topPt.fY > mid.fY || (topPt.fY == mid.fY && topPt.fX > mid.fX)) {
309 topPt = mid; 309 topPt = mid;
310 } 310 }
311 } 311 }
312 } 312 }
313 return topPt; 313 return topPt;
314 } 314 }
315 315
316 SkDPoint SkDCubic::xyAtT(double t) const { 316 SkDPoint SkDCubic::ptAtT(double t) const {
317 if (0 == t) {
318 return fPts[0];
319 }
320 if (1 == t) {
321 return fPts[3];
322 }
317 double one_t = 1 - t; 323 double one_t = 1 - t;
318 double one_t2 = one_t * one_t; 324 double one_t2 = one_t * one_t;
319 double a = one_t2 * one_t; 325 double a = one_t2 * one_t;
320 double b = 3 * one_t2 * t; 326 double b = 3 * one_t2 * t;
321 double t2 = t * t; 327 double t2 = t * t;
322 double c = 3 * one_t * t2; 328 double c = 3 * one_t * t2;
323 double d = t2 * t; 329 double d = t2 * t;
324 SkDPoint result = {a * fPts[0].fX + b * fPts[1].fX + c * fPts[2].fX + d * fP ts[3].fX, 330 SkDPoint result = {a * fPts[0].fX + b * fPts[1].fX + c * fPts[2].fX + d * fP ts[3].fX,
325 a * fPts[0].fY + b * fPts[1].fY + c * fPts[2].fY + d * fPts[3].fY}; 331 a * fPts[0].fY + b * fPts[1].fY + c * fPts[2].fY + d * fPts[3].fY};
326 return result; 332 return result;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 dst.pts[4].fY = (fPts[1].fY + 2 * fPts[2].fY + fPts[3].fY) / 4; 501 dst.pts[4].fY = (fPts[1].fY + 2 * fPts[2].fY + fPts[3].fY) / 4;
496 dst.pts[5].fX = (fPts[2].fX + fPts[3].fX) / 2; 502 dst.pts[5].fX = (fPts[2].fX + fPts[3].fX) / 2;
497 dst.pts[5].fY = (fPts[2].fY + fPts[3].fY) / 2; 503 dst.pts[5].fY = (fPts[2].fY + fPts[3].fY) / 2;
498 dst.pts[6] = fPts[3]; 504 dst.pts[6] = fPts[3];
499 return dst; 505 return dst;
500 } 506 }
501 interp_cubic_coords(&fPts[0].fX, &dst.pts[0].fX, t); 507 interp_cubic_coords(&fPts[0].fX, &dst.pts[0].fX, t);
502 interp_cubic_coords(&fPts[0].fY, &dst.pts[0].fY, t); 508 interp_cubic_coords(&fPts[0].fY, &dst.pts[0].fY, t);
503 return dst; 509 return dst;
504 } 510 }
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsCubic.h ('k') | src/pathops/SkPathOpsCurve.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698