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

Side by Side Diff: src/pathops/SkOpCoincidence.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/SkOpCoincidence.h ('k') | src/pathops/SkOpContour.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 "SkOpCoincidence.h" 7 #include "SkOpCoincidence.h"
8 #include "SkOpSegment.h" 8 #include "SkOpSegment.h"
9 #include "SkPathOpsTSect.h" 9 #include "SkPathOpsTSect.h"
10 10
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 210
211 /* detects overlaps of different coincident runs on same segment */ 211 /* detects overlaps of different coincident runs on same segment */
212 /* does not detect overlaps for pairs without any segments in common */ 212 /* does not detect overlaps for pairs without any segments in common */
213 bool SkOpCoincidence::addMissing(SkChunkAlloc* allocator) { 213 bool SkOpCoincidence::addMissing(SkChunkAlloc* allocator) {
214 SkCoincidentSpans* outer = fHead; 214 SkCoincidentSpans* outer = fHead;
215 if (!outer) { 215 if (!outer) {
216 return true; 216 return true;
217 } 217 }
218 bool result; 218 bool result;
219 fTop = outer; 219 fTop = outer;
220 fHead = NULL; 220 fHead = nullptr;
221 do { 221 do {
222 // addifmissing can modify the list that this is walking 222 // addifmissing can modify the list that this is walking
223 // maybe save head so that walker can iterate over old data unperturbed 223 // maybe save head so that walker can iterate over old data unperturbed
224 // and addifmissing can add to head freely then add saved head in the end 224 // and addifmissing can add to head freely then add saved head in the end
225 const SkOpSegment* outerCoin = outer->fCoinPtTStart->segment(); 225 const SkOpSegment* outerCoin = outer->fCoinPtTStart->segment();
226 SkASSERT(outerCoin == outer->fCoinPtTEnd->segment()); 226 SkASSERT(outerCoin == outer->fCoinPtTEnd->segment());
227 const SkOpSegment* outerOpp = outer->fOppPtTStart->segment(); 227 const SkOpSegment* outerOpp = outer->fOppPtTStart->segment();
228 SkASSERT(outerOpp == outer->fOppPtTEnd->segment()); 228 SkASSERT(outerOpp == outer->fOppPtTEnd->segment());
229 SkCoincidentSpans* inner = outer; 229 SkCoincidentSpans* inner = outer;
230 while ((inner = inner->fNext)) { 230 while ((inner = inner->fNext)) {
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 oNext = oStart; 460 oNext = oStart;
461 } 461 }
462 oStart = oNext->upCast(); 462 oStart = oNext->upCast();
463 } while (true); 463 } while (true);
464 } while ((coin = coin->fNext)); 464 } while ((coin = coin->fNext));
465 return true; 465 return true;
466 } 466 }
467 467
468 void SkOpCoincidence::detach(SkCoincidentSpans* remove) { 468 void SkOpCoincidence::detach(SkCoincidentSpans* remove) {
469 SkCoincidentSpans* coin = fHead; 469 SkCoincidentSpans* coin = fHead;
470 SkCoincidentSpans* prev = NULL; 470 SkCoincidentSpans* prev = nullptr;
471 SkCoincidentSpans* next; 471 SkCoincidentSpans* next;
472 do { 472 do {
473 next = coin->fNext; 473 next = coin->fNext;
474 if (coin == remove) { 474 if (coin == remove) {
475 if (prev) { 475 if (prev) {
476 prev->fNext = next; 476 prev->fNext = next;
477 } else { 477 } else {
478 fHead = next; 478 fHead = next;
479 } 479 }
480 break; 480 break;
(...skipping 17 matching lines...) Expand all
498 SkOpSpan* prev = start->prev(); 498 SkOpSpan* prev = start->prev();
499 SkOpPtT* oppPtT; 499 SkOpPtT* oppPtT;
500 if (prev && (oppPtT = prev->contains(oppSegment))) { 500 if (prev && (oppPtT = prev->contains(oppSegment))) {
501 double midT = (prev->t() + start->t()) / 2; 501 double midT = (prev->t() + start->t()) / 2;
502 if (segment->isClose(midT, oppSegment)) { 502 if (segment->isClose(midT, oppSegment)) {
503 coin->fCoinPtTStart = prev->ptT(); 503 coin->fCoinPtTStart = prev->ptT();
504 coin->fOppPtTStart = oppPtT; 504 coin->fOppPtTStart = oppPtT;
505 expanded = true; 505 expanded = true;
506 } 506 }
507 } 507 }
508 SkOpSpanBase* next = end->final() ? NULL : end->upCast()->next(); 508 SkOpSpanBase* next = end->final() ? nullptr : end->upCast()->next();
509 if (next && (oppPtT = next->contains(oppSegment))) { 509 if (next && (oppPtT = next->contains(oppSegment))) {
510 double midT = (end->t() + next->t()) / 2; 510 double midT = (end->t() + next->t()) / 2;
511 if (segment->isClose(midT, oppSegment)) { 511 if (segment->isClose(midT, oppSegment)) {
512 coin->fCoinPtTEnd = next->ptT(); 512 coin->fCoinPtTEnd = next->ptT();
513 coin->fOppPtTEnd = oppPtT; 513 coin->fOppPtTEnd = oppPtT;
514 expanded = true; 514 expanded = true;
515 } 515 }
516 } 516 }
517 } while ((coin = coin->fNext)); 517 } while ((coin = coin->fNext));
518 return expanded; 518 return expanded;
519 } 519 }
520 520
521 void SkOpCoincidence::findOverlaps(SkOpCoincidence* overlaps, SkChunkAlloc* allo cator) const { 521 void SkOpCoincidence::findOverlaps(SkOpCoincidence* overlaps, SkChunkAlloc* allo cator) const {
522 overlaps->fHead = overlaps->fTop = NULL; 522 overlaps->fHead = overlaps->fTop = nullptr;
523 SkDEBUGCODE_(overlaps->debugSetGlobalState(fDebugState)); 523 SkDEBUGCODE_(overlaps->debugSetGlobalState(fDebugState));
524 SkCoincidentSpans* outer = fHead; 524 SkCoincidentSpans* outer = fHead;
525 while (outer) { 525 while (outer) {
526 SkOpSegment* outerCoin = outer->fCoinPtTStart->segment(); 526 SkOpSegment* outerCoin = outer->fCoinPtTStart->segment();
527 SkOpSegment* outerOpp = outer->fOppPtTStart->segment(); 527 SkOpSegment* outerOpp = outer->fOppPtTStart->segment();
528 SkCoincidentSpans* inner = outer; 528 SkCoincidentSpans* inner = outer;
529 while ((inner = inner->fNext)) { 529 while ((inner = inner->fNext)) {
530 SkOpSegment* innerCoin = inner->fCoinPtTStart->segment(); 530 SkOpSegment* innerCoin = inner->fCoinPtTStart->segment();
531 if (outerCoin == innerCoin) { 531 if (outerCoin == innerCoin) {
532 continue; // both winners are the same segment, so there's no a dditional overlap 532 continue; // both winners are the same segment, so there's no a dditional overlap
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 *overS = SkTMax(SkTMin(coin1s->fT, coin1e->fT), SkTMin(coin2s->fT, coin2e->f T)); 660 *overS = SkTMax(SkTMin(coin1s->fT, coin1e->fT), SkTMin(coin2s->fT, coin2e->f T));
661 *overE = SkTMin(SkTMax(coin1s->fT, coin1e->fT), SkTMax(coin2s->fT, coin2e->f T)); 661 *overE = SkTMin(SkTMax(coin1s->fT, coin1e->fT), SkTMax(coin2s->fT, coin2e->f T));
662 return *overS < *overE; 662 return *overS < *overE;
663 } 663 }
664 664
665 bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, SkOpPtT * testS, 665 bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, SkOpPtT * testS,
666 SkOpPtT* testE) const { 666 SkOpPtT* testE) const {
667 return testS->segment()->testForCoincidence(testS, testE, testS->span(), 667 return testS->segment()->testForCoincidence(testS, testE, testS->span(),
668 testE->span(), outer->fCoinPtTStart->segment(), 120000); // FIXME: replace with tuned 668 testE->span(), outer->fCoinPtTStart->segment(), 120000); // FIXME: replace with tuned
669 } 669 }
OLDNEW
« no previous file with comments | « src/pathops/SkOpCoincidence.h ('k') | src/pathops/SkOpContour.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698