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

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

Issue 131103009: update pathops to circle sort (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: disable old test that still fails on linux 32 release Created 6 years, 8 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/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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 SkDCubic sub = subDivide(t1, t2); 448 SkDCubic sub = subDivide(t1, t2);
449 dst[0] = sub[1] + (a - sub[0]); 449 dst[0] = sub[1] + (a - sub[0]);
450 dst[1] = sub[2] + (d - sub[3]); 450 dst[1] = sub[2] + (d - sub[3]);
451 #endif 451 #endif
452 if (t1 == 0 || t2 == 0) { 452 if (t1 == 0 || t2 == 0) {
453 align(0, 1, t1 == 0 ? &dst[0] : &dst[1]); 453 align(0, 1, t1 == 0 ? &dst[0] : &dst[1]);
454 } 454 }
455 if (t1 == 1 || t2 == 1) { 455 if (t1 == 1 || t2 == 1) {
456 align(3, 2, t1 == 1 ? &dst[0] : &dst[1]); 456 align(3, 2, t1 == 1 ? &dst[0] : &dst[1]);
457 } 457 }
458 if (precisely_subdivide_equal(dst[0].fX, a.fX)) { 458 if (AlmostBequalUlps(dst[0].fX, a.fX)) {
459 dst[0].fX = a.fX; 459 dst[0].fX = a.fX;
460 } 460 }
461 if (precisely_subdivide_equal(dst[0].fY, a.fY)) { 461 if (AlmostBequalUlps(dst[0].fY, a.fY)) {
462 dst[0].fY = a.fY; 462 dst[0].fY = a.fY;
463 } 463 }
464 if (precisely_subdivide_equal(dst[1].fX, d.fX)) { 464 if (AlmostBequalUlps(dst[1].fX, d.fX)) {
465 dst[1].fX = d.fX; 465 dst[1].fX = d.fX;
466 } 466 }
467 if (precisely_subdivide_equal(dst[1].fY, d.fY)) { 467 if (AlmostBequalUlps(dst[1].fY, d.fY)) {
468 dst[1].fY = d.fY; 468 dst[1].fY = d.fY;
469 } 469 }
470 } 470 }
471 471
472 /* classic one t subdivision */ 472 /* classic one t subdivision */
473 static void interp_cubic_coords(const double* src, double* dst, double t) { 473 static void interp_cubic_coords(const double* src, double* dst, double t) {
474 double ab = SkDInterp(src[0], src[2], t); 474 double ab = SkDInterp(src[0], src[2], t);
475 double bc = SkDInterp(src[2], src[4], t); 475 double bc = SkDInterp(src[2], src[4], t);
476 double cd = SkDInterp(src[4], src[6], t); 476 double cd = SkDInterp(src[4], src[6], t);
477 double abc = SkDInterp(ab, bc, t); 477 double abc = SkDInterp(ab, bc, t);
(...skipping 23 matching lines...) Expand all
501 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;
502 dst.pts[5].fX = (fPts[2].fX + fPts[3].fX) / 2; 502 dst.pts[5].fX = (fPts[2].fX + fPts[3].fX) / 2;
503 dst.pts[5].fY = (fPts[2].fY + fPts[3].fY) / 2; 503 dst.pts[5].fY = (fPts[2].fY + fPts[3].fY) / 2;
504 dst.pts[6] = fPts[3]; 504 dst.pts[6] = fPts[3];
505 return dst; 505 return dst;
506 } 506 }
507 interp_cubic_coords(&fPts[0].fX, &dst.pts[0].fX, t); 507 interp_cubic_coords(&fPts[0].fX, &dst.pts[0].fX, t);
508 interp_cubic_coords(&fPts[0].fY, &dst.pts[0].fY, t); 508 interp_cubic_coords(&fPts[0].fY, &dst.pts[0].fY, t);
509 return dst; 509 return dst;
510 } 510 }
511
512 #ifdef SK_DEBUG
513 void SkDCubic::dump() {
514 SkDebugf("{{");
515 int index = 0;
516 do {
517 fPts[index].dump();
518 SkDebugf(", ");
519 } while (++index < 3);
520 fPts[index].dump();
521 SkDebugf("}}\n");
522 }
523 #endif
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