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

Side by Side Diff: src/pathops/SkOpSpan.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/SkOpSpan.h ('k') | src/pathops/SkPathOpsCommon.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 2014 Google Inc. 2 * Copyright 2014 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 "SkOpCoincidence.h" 7 #include "SkOpCoincidence.h"
8 #include "SkOpContour.h" 8 #include "SkOpContour.h"
9 #include "SkOpSegment.h" 9 #include "SkOpSegment.h"
10 #include "SkPathWriter.h" 10 #include "SkPathWriter.h"
(...skipping 26 matching lines...) Expand all
37 37
38 SkOpPtT* SkOpPtT::contains(const SkOpSegment* check) { 38 SkOpPtT* SkOpPtT::contains(const SkOpSegment* check) {
39 SkASSERT(this->segment() != check); 39 SkASSERT(this->segment() != check);
40 SkOpPtT* ptT = this; 40 SkOpPtT* ptT = this;
41 const SkOpPtT* stopPtT = ptT; 41 const SkOpPtT* stopPtT = ptT;
42 while ((ptT = ptT->next()) != stopPtT) { 42 while ((ptT = ptT->next()) != stopPtT) {
43 if (ptT->segment() == check) { 43 if (ptT->segment() == check) {
44 return ptT; 44 return ptT;
45 } 45 }
46 } 46 }
47 return NULL; 47 return nullptr;
48 } 48 }
49 49
50 SkOpContour* SkOpPtT::contour() const { 50 SkOpContour* SkOpPtT::contour() const {
51 return segment()->contour(); 51 return segment()->contour();
52 } 52 }
53 53
54 SkOpPtT* SkOpPtT::doppelganger() { 54 SkOpPtT* SkOpPtT::doppelganger() {
55 SkASSERT(fDeleted); 55 SkASSERT(fDeleted);
56 SkOpPtT* ptT = fNext; 56 SkOpPtT* ptT = fNext;
57 while (ptT->fDeleted) { 57 while (ptT->fDeleted) {
58 ptT = ptT->fNext; 58 ptT = ptT->fNext;
59 } 59 }
60 const SkOpPtT* stopPtT = ptT; 60 const SkOpPtT* stopPtT = ptT;
61 do { 61 do {
62 if (ptT->fSpan == fSpan) { 62 if (ptT->fSpan == fSpan) {
63 return ptT; 63 return ptT;
64 } 64 }
65 ptT = ptT->fNext; 65 ptT = ptT->fNext;
66 } while (stopPtT != ptT); 66 } while (stopPtT != ptT);
67 SkASSERT(0); 67 SkASSERT(0);
68 return NULL; 68 return nullptr;
69 } 69 }
70 70
71 SkOpPtT* SkOpPtT::find(SkOpSegment* segment) { 71 SkOpPtT* SkOpPtT::find(SkOpSegment* segment) {
72 SkOpPtT* ptT = this; 72 SkOpPtT* ptT = this;
73 const SkOpPtT* stopPtT = ptT; 73 const SkOpPtT* stopPtT = ptT;
74 do { 74 do {
75 if (ptT->segment() == segment) { 75 if (ptT->segment() == segment) {
76 return ptT; 76 return ptT;
77 } 77 }
78 ptT = ptT->fNext; 78 ptT = ptT->fNext;
79 } while (stopPtT != ptT); 79 } while (stopPtT != ptT);
80 SkASSERT(0); 80 SkASSERT(0);
81 return NULL; 81 return nullptr;
82 } 82 }
83 83
84 SkOpGlobalState* SkOpPtT::globalState() const { 84 SkOpGlobalState* SkOpPtT::globalState() const {
85 return contour()->globalState(); 85 return contour()->globalState();
86 } 86 }
87 87
88 void SkOpPtT::init(SkOpSpanBase* span, double t, const SkPoint& pt, bool duplica te) { 88 void SkOpPtT::init(SkOpSpanBase* span, double t, const SkPoint& pt, bool duplica te) {
89 fT = t; 89 fT = t;
90 fPt = pt; 90 fPt = pt;
91 fSpan = span; 91 fSpan = span;
(...skipping 28 matching lines...) Expand all
120 SkOpPtT* next = prev->fNext; 120 SkOpPtT* next = prev->fNext;
121 if (next == this) { 121 if (next == this) {
122 prev->removeNext(this); 122 prev->removeNext(this);
123 SkASSERT(prev->fNext != prev); 123 SkASSERT(prev->fNext != prev);
124 fDeleted = true; 124 fDeleted = true;
125 return prev; 125 return prev;
126 } 126 }
127 prev = next; 127 prev = next;
128 } while (prev != this); 128 } while (prev != this);
129 SkASSERT(0); 129 SkASSERT(0);
130 return NULL; 130 return nullptr;
131 } 131 }
132 132
133 void SkOpPtT::removeNext(SkOpPtT* kept) { 133 void SkOpPtT::removeNext(SkOpPtT* kept) {
134 SkASSERT(this->fNext); 134 SkASSERT(this->fNext);
135 SkOpPtT* next = this->fNext; 135 SkOpPtT* next = this->fNext;
136 SkASSERT(this != next->fNext); 136 SkASSERT(this != next->fNext);
137 this->fNext = next->fNext; 137 this->fNext = next->fNext;
138 SkOpSpanBase* span = next->span(); 138 SkOpSpanBase* span = next->span();
139 next->setDeleted(); 139 next->setDeleted();
140 if (span->ptT() == next) { 140 if (span->ptT() == next) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 245 }
246 246
247 SkOpPtT* SkOpSpanBase::contains(const SkOpSegment* segment) { 247 SkOpPtT* SkOpSpanBase::contains(const SkOpSegment* segment) {
248 SkOpPtT* start = &fPtT; 248 SkOpPtT* start = &fPtT;
249 SkOpPtT* walk = start; 249 SkOpPtT* walk = start;
250 while ((walk = walk->next()) != start) { 250 while ((walk = walk->next()) != start) {
251 if (walk->segment() == segment) { 251 if (walk->segment() == segment) {
252 return walk; 252 return walk;
253 } 253 }
254 } 254 }
255 return NULL; 255 return nullptr;
256 } 256 }
257 257
258 bool SkOpSpanBase::containsCoinEnd(const SkOpSegment* segment) const { 258 bool SkOpSpanBase::containsCoinEnd(const SkOpSegment* segment) const {
259 SkASSERT(this->segment() != segment); 259 SkASSERT(this->segment() != segment);
260 const SkOpSpanBase* next = this; 260 const SkOpSpanBase* next = this;
261 while ((next = next->fCoinEnd) != this) { 261 while ((next = next->fCoinEnd) != this) {
262 if (next->segment() == segment) { 262 if (next->segment() == segment) {
263 return true; 263 return true;
264 } 264 }
265 } 265 }
266 return false; 266 return false;
267 } 267 }
268 268
269 SkOpContour* SkOpSpanBase::contour() const { 269 SkOpContour* SkOpSpanBase::contour() const {
270 return segment()->contour(); 270 return segment()->contour();
271 } 271 }
272 272
273 SkOpGlobalState* SkOpSpanBase::globalState() const { 273 SkOpGlobalState* SkOpSpanBase::globalState() const {
274 return contour()->globalState(); 274 return contour()->globalState();
275 } 275 }
276 276
277 void SkOpSpanBase::initBase(SkOpSegment* segment, SkOpSpan* prev, double t, cons t SkPoint& pt) { 277 void SkOpSpanBase::initBase(SkOpSegment* segment, SkOpSpan* prev, double t, cons t SkPoint& pt) {
278 fSegment = segment; 278 fSegment = segment;
279 fPtT.init(this, t, pt, false); 279 fPtT.init(this, t, pt, false);
280 fCoinEnd = this; 280 fCoinEnd = this;
281 fFromAngle = NULL; 281 fFromAngle = nullptr;
282 fPrev = prev; 282 fPrev = prev;
283 fSpanAdds = 0; 283 fSpanAdds = 0;
284 fAligned = true; 284 fAligned = true;
285 fChased = false; 285 fChased = false;
286 SkDEBUGCODE(fCount = 1); 286 SkDEBUGCODE(fCount = 1);
287 SkDEBUGCODE(fID = globalState()->nextSpanID()); 287 SkDEBUGCODE(fID = globalState()->nextSpanID());
288 } 288 }
289 289
290 // this pair of spans share a common t value or point; merge them and eliminate duplicates 290 // this pair of spans share a common t value or point; merge them and eliminate duplicates
291 // this does not compute the best t or pt value; this merely moves all data into a single list 291 // this does not compute the best t or pt value; this merely moves all data into a single list
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 if (coincidence) { 347 if (coincidence) {
348 coincidence->fixUp(this->ptT(), kept); 348 coincidence->fixUp(this->ptT(), kept);
349 } 349 }
350 this->ptT()->setDeleted(); 350 this->ptT()->setDeleted();
351 } 351 }
352 352
353 void SkOpSpan::init(SkOpSegment* segment, SkOpSpan* prev, double t, const SkPoin t& pt) { 353 void SkOpSpan::init(SkOpSegment* segment, SkOpSpan* prev, double t, const SkPoin t& pt) {
354 SkASSERT(t != 1); 354 SkASSERT(t != 1);
355 initBase(segment, prev, t, pt); 355 initBase(segment, prev, t, pt);
356 fCoincident = this; 356 fCoincident = this;
357 fToAngle = NULL; 357 fToAngle = nullptr;
358 fWindSum = fOppSum = SK_MinS32; 358 fWindSum = fOppSum = SK_MinS32;
359 fWindValue = 1; 359 fWindValue = 1;
360 fOppValue = 0; 360 fOppValue = 0;
361 fTopTTry = 0; 361 fTopTTry = 0;
362 fChased = fDone = false; 362 fChased = fDone = false;
363 segment->bumpCount(); 363 segment->bumpCount();
364 } 364 }
365 365
366 void SkOpSpan::setOppSum(int oppSum) { 366 void SkOpSpan::setOppSum(int oppSum) {
367 SkASSERT(!final()); 367 SkASSERT(!final());
368 if (fOppSum != SK_MinS32 && fOppSum != oppSum) { 368 if (fOppSum != SK_MinS32 && fOppSum != oppSum) {
369 this->globalState()->setWindingFailed(); 369 this->globalState()->setWindingFailed();
370 return; 370 return;
371 } 371 }
372 SkASSERT(!DEBUG_LIMIT_WIND_SUM || SkTAbs(oppSum) <= DEBUG_LIMIT_WIND_SUM); 372 SkASSERT(!DEBUG_LIMIT_WIND_SUM || SkTAbs(oppSum) <= DEBUG_LIMIT_WIND_SUM);
373 fOppSum = oppSum; 373 fOppSum = oppSum;
374 } 374 }
375 375
376 void SkOpSpan::setWindSum(int windSum) { 376 void SkOpSpan::setWindSum(int windSum) {
377 SkASSERT(!final()); 377 SkASSERT(!final());
378 if (fWindSum != SK_MinS32 && fWindSum != windSum) { 378 if (fWindSum != SK_MinS32 && fWindSum != windSum) {
379 this->globalState()->setWindingFailed(); 379 this->globalState()->setWindingFailed();
380 return; 380 return;
381 } 381 }
382 SkASSERT(!DEBUG_LIMIT_WIND_SUM || SkTAbs(windSum) <= DEBUG_LIMIT_WIND_SUM); 382 SkASSERT(!DEBUG_LIMIT_WIND_SUM || SkTAbs(windSum) <= DEBUG_LIMIT_WIND_SUM);
383 fWindSum = windSum; 383 fWindSum = windSum;
384 } 384 }
OLDNEW
« no previous file with comments | « src/pathops/SkOpSpan.h ('k') | src/pathops/SkPathOpsCommon.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698