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

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

Issue 2169863002: fix fuzzer bug (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | src/pathops/SkOpCoincidence.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 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 "SkPathOpsConic.h" 8 #include "SkPathOpsConic.h"
9 #include "SkPathOpsCurve.h" 9 #include "SkPathOpsCurve.h"
10 #include "SkPathOpsLine.h" 10 #include "SkPathOpsLine.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 this->addExactHorizontalEndPoints(left, right, axisIntercept); 73 this->addExactHorizontalEndPoints(left, right, axisIntercept);
74 if (fAllowNear) { 74 if (fAllowNear) {
75 this->addNearHorizontalEndPoints(left, right, axisIntercept); 75 this->addNearHorizontalEndPoints(left, right, axisIntercept);
76 } 76 }
77 double roots[2]; 77 double roots[2];
78 int count = this->horizontalIntersect(axisIntercept, roots); 78 int count = this->horizontalIntersect(axisIntercept, roots);
79 for (int index = 0; index < count; ++index) { 79 for (int index = 0; index < count; ++index) {
80 double conicT = roots[index]; 80 double conicT = roots[index];
81 SkDPoint pt = fConic.ptAtT(conicT); 81 SkDPoint pt = fConic.ptAtT(conicT);
82 SkDEBUGCODE_(double conicVals[] = { fConic[0].fY, fConic[1].fY, fCon ic[2].fY }); 82 SkDEBUGCODE_(double conicVals[] = { fConic[0].fY, fConic[1].fY, fCon ic[2].fY });
83 SkASSERT(close_to(pt.fY, axisIntercept, conicVals)); 83 SkOPOBJASSERT(fIntersections, close_to(pt.fY, axisIntercept, conicVa ls));
84 double lineT = (pt.fX - left) / (right - left); 84 double lineT = (pt.fX - left) / (right - left);
85 if (this->pinTs(&conicT, &lineT, &pt, kPointInitialized) 85 if (this->pinTs(&conicT, &lineT, &pt, kPointInitialized)
86 && this->uniqueAnswer(conicT, pt)) { 86 && this->uniqueAnswer(conicT, pt)) {
87 fIntersections->insert(conicT, lineT, pt); 87 fIntersections->insert(conicT, lineT, pt);
88 } 88 }
89 } 89 }
90 if (flipped) { 90 if (flipped) {
91 fIntersections->flip(); 91 fIntersections->flip();
92 } 92 }
93 this->checkCoincident(); 93 this->checkCoincident();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 this->addExactVerticalEndPoints(top, bottom, axisIntercept); 151 this->addExactVerticalEndPoints(top, bottom, axisIntercept);
152 if (fAllowNear) { 152 if (fAllowNear) {
153 this->addNearVerticalEndPoints(top, bottom, axisIntercept); 153 this->addNearVerticalEndPoints(top, bottom, axisIntercept);
154 } 154 }
155 double roots[2]; 155 double roots[2];
156 int count = this->verticalIntersect(axisIntercept, roots); 156 int count = this->verticalIntersect(axisIntercept, roots);
157 for (int index = 0; index < count; ++index) { 157 for (int index = 0; index < count; ++index) {
158 double conicT = roots[index]; 158 double conicT = roots[index];
159 SkDPoint pt = fConic.ptAtT(conicT); 159 SkDPoint pt = fConic.ptAtT(conicT);
160 SkDEBUGCODE_(double conicVals[] = { fConic[0].fX, fConic[1].fX, fCon ic[2].fX }); 160 SkDEBUGCODE_(double conicVals[] = { fConic[0].fX, fConic[1].fX, fCon ic[2].fX });
161 SkASSERT((fIntersections->debugGlobalState() && 161 SkOPOBJASSERT(fIntersections, close_to(pt.fX, axisIntercept, conicVa ls));
162 fIntersections->debugGlobalState()->debugSkipAssert()) ||
163 close_to(pt.fX, axisIntercept, conicVals));
164 double lineT = (pt.fY - top) / (bottom - top); 162 double lineT = (pt.fY - top) / (bottom - top);
165 if (this->pinTs(&conicT, &lineT, &pt, kPointInitialized) 163 if (this->pinTs(&conicT, &lineT, &pt, kPointInitialized)
166 && this->uniqueAnswer(conicT, pt)) { 164 && this->uniqueAnswer(conicT, pt)) {
167 fIntersections->insert(conicT, lineT, pt); 165 fIntersections->insert(conicT, lineT, pt);
168 } 166 }
169 } 167 }
170 if (flipped) { 168 if (flipped) {
171 fIntersections->flip(); 169 fIntersections->flip();
172 } 170 }
173 this->checkCoincident(); 171 this->checkCoincident();
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 375
378 int SkIntersections::HorizontalIntercept(const SkDConic& conic, SkScalar y, doub le* roots) { 376 int SkIntersections::HorizontalIntercept(const SkDConic& conic, SkScalar y, doub le* roots) {
379 LineConicIntersections c(conic); 377 LineConicIntersections c(conic);
380 return c.horizontalIntersect(y, roots); 378 return c.horizontalIntersect(y, roots);
381 } 379 }
382 380
383 int SkIntersections::VerticalIntercept(const SkDConic& conic, SkScalar x, double * roots) { 381 int SkIntersections::VerticalIntercept(const SkDConic& conic, SkScalar x, double * roots) {
384 LineConicIntersections c(conic); 382 LineConicIntersections c(conic);
385 return c.verticalIntersect(x, roots); 383 return c.verticalIntersect(x, roots);
386 } 384 }
OLDNEW
« no previous file with comments | « no previous file | src/pathops/SkOpCoincidence.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698