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

Side by Side Diff: src/pathops/SkPathOpsQuad.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/SkPathOpsCubic.cpp ('k') | src/pathops/SkPathOpsTSect.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 "SkIntersections.h" 7 #include "SkIntersections.h"
8 #include "SkLineParameters.h" 8 #include "SkLineParameters.h"
9 #include "SkPathOpsCubic.h" 9 #include "SkPathOpsCubic.h"
10 #include "SkPathOpsCurve.h" 10 #include "SkPathOpsCurve.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 largest = SkTMax(largest, -tiniest); 154 largest = SkTMax(largest, -tiniest);
155 return approximately_zero_when_compared_to(distance, largest); 155 return approximately_zero_when_compared_to(distance, largest);
156 } 156 }
157 157
158 SkDVector SkDQuad::dxdyAtT(double t) const { 158 SkDVector SkDQuad::dxdyAtT(double t) const {
159 double a = t - 1; 159 double a = t - 1;
160 double b = 1 - 2 * t; 160 double b = 1 - 2 * t;
161 double c = t; 161 double c = t;
162 SkDVector result = { a * fPts[0].fX + b * fPts[1].fX + c * fPts[2].fX, 162 SkDVector result = { a * fPts[0].fX + b * fPts[1].fX + c * fPts[2].fX,
163 a * fPts[0].fY + b * fPts[1].fY + c * fPts[2].fY }; 163 a * fPts[0].fY + b * fPts[1].fY + c * fPts[2].fY };
164 if (result.fX == 0 && result.fY == 0) {
165 if (zero_or_one(t)) {
166 result = fPts[2] - fPts[0];
167 } else {
168 // incomplete
169 SkDebugf("!q");
170 }
171 }
164 return result; 172 return result;
165 } 173 }
166 174
167 // OPTIMIZE: assert if caller passes in t == 0 / t == 1 ? 175 // OPTIMIZE: assert if caller passes in t == 0 / t == 1 ?
168 SkDPoint SkDQuad::ptAtT(double t) const { 176 SkDPoint SkDQuad::ptAtT(double t) const {
169 if (0 == t) { 177 if (0 == t) {
170 return fPts[0]; 178 return fPts[0];
171 } 179 }
172 if (1 == t) { 180 if (1 == t) {
173 return fPts[2]; 181 return fPts[2];
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 * c = C 341 * c = C
334 */ 342 */
335 void SkDQuad::SetABC(const double* quad, double* a, double* b, double* c) { 343 void SkDQuad::SetABC(const double* quad, double* a, double* b, double* c) {
336 *a = quad[0]; // a = A 344 *a = quad[0]; // a = A
337 *b = 2 * quad[2]; // b = 2*B 345 *b = 2 * quad[2]; // b = 2*B
338 *c = quad[4]; // c = C 346 *c = quad[4]; // c = C
339 *b -= *c; // b = 2*B - C 347 *b -= *c; // b = 2*B - C
340 *a -= *b; // a = A - 2*B + C 348 *a -= *b; // a = A - 2*B + C
341 *b -= *c; // b = 2*B - 2*C 349 *b -= *c; // b = 2*B - 2*C
342 } 350 }
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsCubic.cpp ('k') | src/pathops/SkPathOpsTSect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698