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

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

Issue 239563004: fix minor skp-found bugs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix mac-detected errors 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/SkPathOpsCommon.cpp ('k') | src/pathops/SkPathOpsDebug.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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 distance = lineParameters.controlPtDistance(*this, 2); 87 distance = lineParameters.controlPtDistance(*this, 2);
88 return approximately_zero(distance); 88 return approximately_zero(distance);
89 } 89 }
90 90
91 bool SkDCubic::monotonicInY() const { 91 bool SkDCubic::monotonicInY() const {
92 return between(fPts[0].fY, fPts[1].fY, fPts[3].fY) 92 return between(fPts[0].fY, fPts[1].fY, fPts[3].fY)
93 && between(fPts[0].fY, fPts[2].fY, fPts[3].fY); 93 && between(fPts[0].fY, fPts[2].fY, fPts[3].fY);
94 } 94 }
95 95
96 bool SkDCubic::serpentine() const { 96 bool SkDCubic::serpentine() const {
97 #if 0 // FIXME: enabling this fixes cubicOp114 but breaks cubicOp58d and cubicO p53d
98 double tValues[2];
99 // OPTIMIZATION : another case where caching the present of cubic inflection s would be useful
100 return findInflections(tValues) > 1;
101 #endif
97 if (!controlsContainedByEnds()) { 102 if (!controlsContainedByEnds()) {
98 return false; 103 return false;
99 } 104 }
100 double wiggle = (fPts[0].fX - fPts[2].fX) * (fPts[0].fY + fPts[2].fY); 105 double wiggle = (fPts[0].fX - fPts[2].fX) * (fPts[0].fY + fPts[2].fY);
101 for (int idx = 0; idx < 2; ++idx) { 106 for (int idx = 0; idx < 2; ++idx) {
102 wiggle += (fPts[idx + 1].fX - fPts[idx].fX) * (fPts[idx + 1].fY + fPts[i dx].fY); 107 wiggle += (fPts[idx + 1].fX - fPts[idx].fX) * (fPts[idx + 1].fY + fPts[i dx].fY);
103 } 108 }
104 double waggle = (fPts[1].fX - fPts[3].fX) * (fPts[1].fY + fPts[3].fY); 109 double waggle = (fPts[1].fX - fPts[3].fX) * (fPts[1].fY + fPts[3].fY);
105 for (int idx = 1; idx < 3; ++idx) { 110 for (int idx = 1; idx < 3; ++idx) {
106 waggle += (fPts[idx + 1].fX - fPts[idx].fX) * (fPts[idx + 1].fY + fPts[i dx].fY); 111 waggle += (fPts[idx + 1].fX - fPts[idx].fX) * (fPts[idx + 1].fY + fPts[i dx].fY);
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 dst.pts[4].fY = (fPts[1].fY + 2 * fPts[2].fY + fPts[3].fY) / 4; 506 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; 507 dst.pts[5].fX = (fPts[2].fX + fPts[3].fX) / 2;
503 dst.pts[5].fY = (fPts[2].fY + fPts[3].fY) / 2; 508 dst.pts[5].fY = (fPts[2].fY + fPts[3].fY) / 2;
504 dst.pts[6] = fPts[3]; 509 dst.pts[6] = fPts[3];
505 return dst; 510 return dst;
506 } 511 }
507 interp_cubic_coords(&fPts[0].fX, &dst.pts[0].fX, t); 512 interp_cubic_coords(&fPts[0].fX, &dst.pts[0].fX, t);
508 interp_cubic_coords(&fPts[0].fY, &dst.pts[0].fY, t); 513 interp_cubic_coords(&fPts[0].fY, &dst.pts[0].fY, t);
509 return dst; 514 return dst;
510 } 515 }
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsCommon.cpp ('k') | src/pathops/SkPathOpsDebug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698