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

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

Issue 2231663002: Fix SkDEBUGCODE to accept commas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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 | « include/core/SkTypes.h ('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 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 int horizontalIntersect(double axisIntercept, double left, double right, boo l flipped) { 72 int horizontalIntersect(double axisIntercept, double left, double right, boo l flipped) {
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, fConi c[2].fY });
83 SkOPOBJASSERT(fIntersections, close_to(pt.fY, axisIntercept, conicVa ls)); 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 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 int verticalIntersect(double axisIntercept, double top, double bottom, bool flipped) { 150 int verticalIntersect(double axisIntercept, double top, double bottom, bool flipped) {
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, fConi c[2].fX });
161 SkOPOBJASSERT(fIntersections, close_to(pt.fX, axisIntercept, conicVa ls)); 161 SkOPOBJASSERT(fIntersections, close_to(pt.fX, axisIntercept, conicVa ls));
162 double lineT = (pt.fY - top) / (bottom - top); 162 double lineT = (pt.fY - top) / (bottom - top);
163 if (this->pinTs(&conicT, &lineT, &pt, kPointInitialized) 163 if (this->pinTs(&conicT, &lineT, &pt, kPointInitialized)
164 && this->uniqueAnswer(conicT, pt)) { 164 && this->uniqueAnswer(conicT, pt)) {
165 fIntersections->insert(conicT, lineT, pt); 165 fIntersections->insert(conicT, lineT, pt);
166 } 166 }
167 } 167 }
168 if (flipped) { 168 if (flipped) {
169 fIntersections->flip(); 169 fIntersections->flip();
170 } 170 }
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 375
376 int SkIntersections::HorizontalIntercept(const SkDConic& conic, SkScalar y, doub le* roots) { 376 int SkIntersections::HorizontalIntercept(const SkDConic& conic, SkScalar y, doub le* roots) {
377 LineConicIntersections c(conic); 377 LineConicIntersections c(conic);
378 return c.horizontalIntersect(y, roots); 378 return c.horizontalIntersect(y, roots);
379 } 379 }
380 380
381 int SkIntersections::VerticalIntercept(const SkDConic& conic, SkScalar x, double * roots) { 381 int SkIntersections::VerticalIntercept(const SkDConic& conic, SkScalar x, double * roots) {
382 LineConicIntersections c(conic); 382 LineConicIntersections c(conic);
383 return c.verticalIntersect(x, roots); 383 return c.verticalIntersect(x, roots);
384 } 384 }
OLDNEW
« no previous file with comments | « include/core/SkTypes.h ('k') | src/pathops/SkPathOpsDebug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698