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

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

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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/SkDLineIntersection.cpp ('k') | src/pathops/SkIntersectionHelper.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 "SkPathOpsLine.h" 8 #include "SkPathOpsLine.h"
9 #include "SkPathOpsQuad.h" 9 #include "SkPathOpsQuad.h"
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 LineQuadraticIntersections(const SkDQuad& q, const SkDLine& l, SkIntersectio ns* i) 96 LineQuadraticIntersections(const SkDQuad& q, const SkDLine& l, SkIntersectio ns* i)
97 : fQuad(q) 97 : fQuad(q)
98 , fLine(&l) 98 , fLine(&l)
99 , fIntersections(i) 99 , fIntersections(i)
100 , fAllowNear(true) { 100 , fAllowNear(true) {
101 i->setMax(3); // allow short partial coincidence plus discrete intersec tion 101 i->setMax(3); // allow short partial coincidence plus discrete intersec tion
102 } 102 }
103 103
104 LineQuadraticIntersections(const SkDQuad& q) 104 LineQuadraticIntersections(const SkDQuad& q)
105 : fQuad(q) 105 : fQuad(q)
106 SkDEBUGPARAMS(fLine(NULL)) 106 SkDEBUGPARAMS(fLine(nullptr))
107 SkDEBUGPARAMS(fIntersections(NULL)) 107 SkDEBUGPARAMS(fIntersections(nullptr))
108 SkDEBUGPARAMS(fAllowNear(false)) { 108 SkDEBUGPARAMS(fAllowNear(false)) {
109 } 109 }
110 110
111 void allowNear(bool allow) { 111 void allowNear(bool allow) {
112 fAllowNear = allow; 112 fAllowNear = allow;
113 } 113 }
114 114
115 void checkCoincident() { 115 void checkCoincident() {
116 int last = fIntersections->used() - 1; 116 int last = fIntersections->used() - 1;
117 for (int index = 0; index < last; ) { 117 for (int index = 0; index < last; ) {
118 double quadMidT = ((*fIntersections)[0][index] + (*fIntersections)[0 ][index + 1]) / 2; 118 double quadMidT = ((*fIntersections)[0][index] + (*fIntersections)[0 ][index + 1]) / 2;
119 SkDPoint quadMidPt = fQuad.ptAtT(quadMidT); 119 SkDPoint quadMidPt = fQuad.ptAtT(quadMidT);
120 double t = fLine->nearPoint(quadMidPt, NULL); 120 double t = fLine->nearPoint(quadMidPt, nullptr);
121 if (t < 0) { 121 if (t < 0) {
122 ++index; 122 ++index;
123 continue; 123 continue;
124 } 124 }
125 if (fIntersections->isCoincident(index)) { 125 if (fIntersections->isCoincident(index)) {
126 fIntersections->removeOne(index); 126 fIntersections->removeOne(index);
127 --last; 127 --last;
128 } else if (fIntersections->isCoincident(index + 1)) { 128 } else if (fIntersections->isCoincident(index + 1)) {
129 fIntersections->removeOne(index + 1); 129 fIntersections->removeOne(index + 1);
130 --last; 130 --last;
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 fIntersections->insert(quadT, lineT, fQuad[qIndex]); 284 fIntersections->insert(quadT, lineT, fQuad[qIndex]);
285 } 285 }
286 } 286 }
287 287
288 void addNearEndPoints() { 288 void addNearEndPoints() {
289 for (int qIndex = 0; qIndex < 3; qIndex += 2) { 289 for (int qIndex = 0; qIndex < 3; qIndex += 2) {
290 double quadT = (double) (qIndex >> 1); 290 double quadT = (double) (qIndex >> 1);
291 if (fIntersections->hasT(quadT)) { 291 if (fIntersections->hasT(quadT)) {
292 continue; 292 continue;
293 } 293 }
294 double lineT = fLine->nearPoint(fQuad[qIndex], NULL); 294 double lineT = fLine->nearPoint(fQuad[qIndex], nullptr);
295 if (lineT < 0) { 295 if (lineT < 0) {
296 continue; 296 continue;
297 } 297 }
298 fIntersections->insert(quadT, lineT, fQuad[qIndex]); 298 fIntersections->insert(quadT, lineT, fQuad[qIndex]);
299 } 299 }
300 // FIXME: see if line end is nearly on quad 300 // FIXME: see if line end is nearly on quad
301 } 301 }
302 302
303 void addExactHorizontalEndPoints(double left, double right, double y) { 303 void addExactHorizontalEndPoints(double left, double right, double y) {
304 for (int qIndex = 0; qIndex < 3; qIndex += 2) { 304 for (int qIndex = 0; qIndex < 3; qIndex += 2) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 435
436 int SkIntersections::HorizontalIntercept(const SkDQuad& quad, SkScalar y, double * roots) { 436 int SkIntersections::HorizontalIntercept(const SkDQuad& quad, SkScalar y, double * roots) {
437 LineQuadraticIntersections q(quad); 437 LineQuadraticIntersections q(quad);
438 return q.horizontalIntersect(y, roots); 438 return q.horizontalIntersect(y, roots);
439 } 439 }
440 440
441 int SkIntersections::VerticalIntercept(const SkDQuad& quad, SkScalar x, double* roots) { 441 int SkIntersections::VerticalIntercept(const SkDQuad& quad, SkScalar x, double* roots) {
442 LineQuadraticIntersections q(quad); 442 LineQuadraticIntersections q(quad);
443 return q.verticalIntersect(x, roots); 443 return q.verticalIntersect(x, roots);
444 } 444 }
OLDNEW
« no previous file with comments | « src/pathops/SkDLineIntersection.cpp ('k') | src/pathops/SkIntersectionHelper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698