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

Side by Side Diff: src/pathops/SkDConicLineIntersection.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/opts/opts_check_x86.cpp ('k') | src/pathops/SkDCubicLineIntersection.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 "SkPathOpsConic.h" 8 #include "SkPathOpsConic.h"
9 #include "SkPathOpsLine.h" 9 #include "SkPathOpsLine.h"
10 10
11 class LineConicIntersections { 11 class LineConicIntersections {
12 public: 12 public:
13 enum PinTPoint { 13 enum PinTPoint {
14 kPointUninitialized, 14 kPointUninitialized,
15 kPointInitialized 15 kPointInitialized
16 }; 16 };
17 17
18 LineConicIntersections(const SkDConic& c, const SkDLine& l, SkIntersections* i) 18 LineConicIntersections(const SkDConic& c, const SkDLine& l, SkIntersections* i)
19 : fConic(c) 19 : fConic(c)
20 , fLine(&l) 20 , fLine(&l)
21 , fIntersections(i) 21 , fIntersections(i)
22 , fAllowNear(true) { 22 , fAllowNear(true) {
23 i->setMax(3); // allow short partial coincidence plus discrete intersec tion 23 i->setMax(3); // allow short partial coincidence plus discrete intersec tion
24 } 24 }
25 25
26 LineConicIntersections(const SkDConic& c) 26 LineConicIntersections(const SkDConic& c)
27 : fConic(c) 27 : fConic(c)
28 SkDEBUGPARAMS(fLine(NULL)) 28 SkDEBUGPARAMS(fLine(nullptr))
29 SkDEBUGPARAMS(fIntersections(NULL)) 29 SkDEBUGPARAMS(fIntersections(nullptr))
30 SkDEBUGPARAMS(fAllowNear(false)) { 30 SkDEBUGPARAMS(fAllowNear(false)) {
31 } 31 }
32 32
33 void allowNear(bool allow) { 33 void allowNear(bool allow) {
34 fAllowNear = allow; 34 fAllowNear = allow;
35 } 35 }
36 36
37 void checkCoincident() { 37 void checkCoincident() {
38 int last = fIntersections->used() - 1; 38 int last = fIntersections->used() - 1;
39 for (int index = 0; index < last; ) { 39 for (int index = 0; index < last; ) {
40 double conicMidT = ((*fIntersections)[0][index] + (*fIntersections)[ 0][index + 1]) / 2; 40 double conicMidT = ((*fIntersections)[0][index] + (*fIntersections)[ 0][index + 1]) / 2;
41 SkDPoint conicMidPt = fConic.ptAtT(conicMidT); 41 SkDPoint conicMidPt = fConic.ptAtT(conicMidT);
42 double t = fLine->nearPoint(conicMidPt, NULL); 42 double t = fLine->nearPoint(conicMidPt, nullptr);
43 if (t < 0) { 43 if (t < 0) {
44 ++index; 44 ++index;
45 continue; 45 continue;
46 } 46 }
47 if (fIntersections->isCoincident(index)) { 47 if (fIntersections->isCoincident(index)) {
48 fIntersections->removeOne(index); 48 fIntersections->removeOne(index);
49 --last; 49 --last;
50 } else if (fIntersections->isCoincident(index + 1)) { 50 } else if (fIntersections->isCoincident(index + 1)) {
51 fIntersections->removeOne(index + 1); 51 fIntersections->removeOne(index + 1);
52 --last; 52 --last;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 fIntersections->insert(conicT, lineT, fConic[cIndex]); 179 fIntersections->insert(conicT, lineT, fConic[cIndex]);
180 } 180 }
181 } 181 }
182 182
183 void addNearEndPoints() { 183 void addNearEndPoints() {
184 for (int cIndex = 0; cIndex < SkDConic::kPointCount; cIndex += SkDConic: :kPointLast) { 184 for (int cIndex = 0; cIndex < SkDConic::kPointCount; cIndex += SkDConic: :kPointLast) {
185 double conicT = (double) (cIndex >> 1); 185 double conicT = (double) (cIndex >> 1);
186 if (fIntersections->hasT(conicT)) { 186 if (fIntersections->hasT(conicT)) {
187 continue; 187 continue;
188 } 188 }
189 double lineT = fLine->nearPoint(fConic[cIndex], NULL); 189 double lineT = fLine->nearPoint(fConic[cIndex], nullptr);
190 if (lineT < 0) { 190 if (lineT < 0) {
191 continue; 191 continue;
192 } 192 }
193 fIntersections->insert(conicT, lineT, fConic[cIndex]); 193 fIntersections->insert(conicT, lineT, fConic[cIndex]);
194 } 194 }
195 // FIXME: see if line end is nearly on conic 195 // FIXME: see if line end is nearly on conic
196 } 196 }
197 197
198 void addExactHorizontalEndPoints(double left, double right, double y) { 198 void addExactHorizontalEndPoints(double left, double right, double y) {
199 for (int cIndex = 0; cIndex < SkDConic::kPointCount; cIndex += SkDConic: :kPointLast) { 199 for (int cIndex = 0; cIndex < SkDConic::kPointCount; cIndex += SkDConic: :kPointLast) {
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 354
355 int SkIntersections::HorizontalIntercept(const SkDConic& conic, SkScalar y, doub le* roots) { 355 int SkIntersections::HorizontalIntercept(const SkDConic& conic, SkScalar y, doub le* roots) {
356 LineConicIntersections c(conic); 356 LineConicIntersections c(conic);
357 return c.horizontalIntersect(y, roots); 357 return c.horizontalIntersect(y, roots);
358 } 358 }
359 359
360 int SkIntersections::VerticalIntercept(const SkDConic& conic, SkScalar x, double * roots) { 360 int SkIntersections::VerticalIntercept(const SkDConic& conic, SkScalar x, double * roots) {
361 LineConicIntersections c(conic); 361 LineConicIntersections c(conic);
362 return c.verticalIntersect(x, roots); 362 return c.verticalIntersect(x, roots);
363 } 363 }
OLDNEW
« no previous file with comments | « src/opts/opts_check_x86.cpp ('k') | src/pathops/SkDCubicLineIntersection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698