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

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

Issue 1809733002: detach -> release (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: (C) Created 4 years, 9 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/SkOpSegment.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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 // if the opposite ran out too soon, just reuse the last span 474 // if the opposite ran out too soon, just reuse the last span
475 if (!oNext || !oNext->upCastable()) { 475 if (!oNext || !oNext->upCastable()) {
476 oNext = oStart; 476 oNext = oStart;
477 } 477 }
478 oStart = oNext->upCast(); 478 oStart = oNext->upCast();
479 } while (true); 479 } while (true);
480 } while ((coin = coin->fNext)); 480 } while ((coin = coin->fNext));
481 return true; 481 return true;
482 } 482 }
483 483
484 void SkOpCoincidence::detach(SkCoincidentSpans* remove) { 484 void SkOpCoincidence::release(SkCoincidentSpans* remove) {
485 SkCoincidentSpans* coin = fHead; 485 SkCoincidentSpans* coin = fHead;
486 SkCoincidentSpans* prev = nullptr; 486 SkCoincidentSpans* prev = nullptr;
487 SkCoincidentSpans* next; 487 SkCoincidentSpans* next;
488 do { 488 do {
489 next = coin->fNext; 489 next = coin->fNext;
490 if (coin == remove) { 490 if (coin == remove) {
491 if (prev) { 491 if (prev) {
492 prev->fNext = next; 492 prev->fNext = next;
493 } else { 493 } else {
494 fHead = next; 494 fHead = next;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 } 597 }
598 598
599 void SkOpCoincidence::fixUp(SkOpPtT* deleted, SkOpPtT* kept) { 599 void SkOpCoincidence::fixUp(SkOpPtT* deleted, SkOpPtT* kept) {
600 SkCoincidentSpans* coin = fHead; 600 SkCoincidentSpans* coin = fHead;
601 if (!coin) { 601 if (!coin) {
602 return; 602 return;
603 } 603 }
604 do { 604 do {
605 if (coin->fCoinPtTStart == deleted) { 605 if (coin->fCoinPtTStart == deleted) {
606 if (coin->fCoinPtTEnd->span() == kept->span()) { 606 if (coin->fCoinPtTEnd->span() == kept->span()) {
607 this->detach(coin); 607 this->release(coin);
608 continue; 608 continue;
609 } 609 }
610 coin->fCoinPtTStart = kept; 610 coin->fCoinPtTStart = kept;
611 } 611 }
612 if (coin->fCoinPtTEnd == deleted) { 612 if (coin->fCoinPtTEnd == deleted) {
613 if (coin->fCoinPtTStart->span() == kept->span()) { 613 if (coin->fCoinPtTStart->span() == kept->span()) {
614 this->detach(coin); 614 this->release(coin);
615 continue; 615 continue;
616 } 616 }
617 coin->fCoinPtTEnd = kept; 617 coin->fCoinPtTEnd = kept;
618 } 618 }
619 if (coin->fOppPtTStart == deleted) { 619 if (coin->fOppPtTStart == deleted) {
620 if (coin->fOppPtTEnd->span() == kept->span()) { 620 if (coin->fOppPtTEnd->span() == kept->span()) {
621 this->detach(coin); 621 this->release(coin);
622 continue; 622 continue;
623 } 623 }
624 coin->fOppPtTStart = kept; 624 coin->fOppPtTStart = kept;
625 } 625 }
626 if (coin->fOppPtTEnd == deleted) { 626 if (coin->fOppPtTEnd == deleted) {
627 if (coin->fOppPtTStart->span() == kept->span()) { 627 if (coin->fOppPtTStart->span() == kept->span()) {
628 this->detach(coin); 628 this->release(coin);
629 continue; 629 continue;
630 } 630 }
631 coin->fOppPtTEnd = kept; 631 coin->fOppPtTEnd = kept;
632 } 632 }
633 } while ((coin = coin->fNext)); 633 } while ((coin = coin->fNext));
634 } 634 }
635 635
636 /* this sets up the coincidence links in the segments when the coincidence cross es multiple spans */ 636 /* this sets up the coincidence links in the segments when the coincidence cross es multiple spans */
637 void SkOpCoincidence::mark() { 637 void SkOpCoincidence::mark() {
638 SkCoincidentSpans* coin = fHead; 638 SkCoincidentSpans* coin = fHead;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 *overS = SkTMax(SkTMin(coin1s->fT, coin1e->fT), SkTMin(coin2s->fT, coin2e->f T)); 676 *overS = SkTMax(SkTMin(coin1s->fT, coin1e->fT), SkTMin(coin2s->fT, coin2e->f T));
677 *overE = SkTMin(SkTMax(coin1s->fT, coin1e->fT), SkTMax(coin2s->fT, coin2e->f T)); 677 *overE = SkTMin(SkTMax(coin1s->fT, coin1e->fT), SkTMax(coin2s->fT, coin2e->f T));
678 return *overS < *overE; 678 return *overS < *overE;
679 } 679 }
680 680
681 bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, const S kOpPtT* testS, 681 bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, const S kOpPtT* testS,
682 const SkOpPtT* testE) const { 682 const SkOpPtT* testE) const {
683 return testS->segment()->testForCoincidence(testS, testE, testS->span(), 683 return testS->segment()->testForCoincidence(testS, testE, testS->span(),
684 testE->span(), outer->fCoinPtTStart->segment(), 120000); // FIXME: replace with tuned 684 testE->span(), outer->fCoinPtTStart->segment(), 120000); // FIXME: replace with tuned
685 } 685 }
OLDNEW
« no previous file with comments | « src/pathops/SkOpCoincidence.h ('k') | src/pathops/SkOpSegment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698