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

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

Issue 1288863004: fix pathops fuzz failures (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix sign mismatch Created 5 years, 4 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/SkIntersections.cpp ('k') | src/pathops/SkPathOpsCubic.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 2015 Google Inc. 2 * Copyright 2015 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 "SkIntersections.h" 7 #include "SkIntersections.h"
8 #include "SkLineParameters.h" 8 #include "SkLineParameters.h"
9 #include "SkPathOpsConic.h" 9 #include "SkPathOpsConic.h"
10 #include "SkPathOpsCubic.h" 10 #include "SkPathOpsCubic.h"
(...skipping 30 matching lines...) Expand all
41 return 1; 41 return 1;
42 } 42 }
43 return 0; 43 return 0;
44 } 44 }
45 45
46 SkDVector SkDConic::dxdyAtT(double t) const { 46 SkDVector SkDConic::dxdyAtT(double t) const {
47 SkDVector result = { 47 SkDVector result = {
48 conic_eval_tan(&fPts[0].fX, fWeight, t), 48 conic_eval_tan(&fPts[0].fX, fWeight, t),
49 conic_eval_tan(&fPts[0].fY, fWeight, t) 49 conic_eval_tan(&fPts[0].fY, fWeight, t)
50 }; 50 };
51 if (result.fX == 0 && result.fY == 0) {
52 if (zero_or_one(t)) {
53 result = fPts[2] - fPts[0];
54 } else {
55 // incomplete
56 SkDebugf("!k");
57 }
58 }
51 return result; 59 return result;
52 } 60 }
53 61
54 static double conic_eval_numerator(const double src[], SkScalar w, double t) { 62 static double conic_eval_numerator(const double src[], SkScalar w, double t) {
55 SkASSERT(src); 63 SkASSERT(src);
56 SkASSERT(t >= 0 && t <= 1); 64 SkASSERT(t >= 0 && t <= 1);
57 double src2w = src[2] * w; 65 double src2w = src[2] * w;
58 double C = src[0]; 66 double C = src[0];
59 double A = src[4] - 2 * src2w + C; 67 double A = src[4] - 2 * src2w + C;
60 double B = 2 * (src2w - C); 68 double B = 2 * (src2w - C);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 SkDConic dst = {{{{ax / az, ay / az}, {bx / bz, by / bz}, {cx / cz, cy / cz} }}, w }; 140 SkDConic dst = {{{{ax / az, ay / az}, {bx / bz, by / bz}, {cx / cz, cy / cz} }}, w };
133 return dst; 141 return dst;
134 } 142 }
135 143
136 SkDPoint SkDConic::subDivide(const SkDPoint& a, const SkDPoint& c, double t1, do uble t2, 144 SkDPoint SkDConic::subDivide(const SkDPoint& a, const SkDPoint& c, double t1, do uble t2,
137 SkScalar* weight) const { 145 SkScalar* weight) const {
138 SkDConic chopped = this->subDivide(t1, t2); 146 SkDConic chopped = this->subDivide(t1, t2);
139 *weight = chopped.fWeight; 147 *weight = chopped.fWeight;
140 return chopped[1]; 148 return chopped[1];
141 } 149 }
OLDNEW
« no previous file with comments | « src/pathops/SkIntersections.cpp ('k') | src/pathops/SkPathOpsCubic.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698