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

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

Issue 2273293004: path ops stream-lining (Closed)
Patch Set: remove commented out code Created 4 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/SkAddIntersections.cpp ('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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 for (int index = 0; index < i.used(); ++index) { 292 for (int index = 0; index < i.used(); ++index) {
293 double t = i[0][index]; 293 double t = i[0][index];
294 if (!between(0, t, 1)) { 294 if (!between(0, t, 1)) {
295 continue; 295 continue;
296 } 296 }
297 SkDPoint oppPt = i.pt(index); 297 SkDPoint oppPt = i.pt(index);
298 if (!oppPt.approximatelyEqual(pt)) { 298 if (!oppPt.approximatelyEqual(pt)) {
299 continue; 299 continue;
300 } 300 }
301 SkOpSegment* writableSeg = const_cast<SkOpSegment*>(testSeg); 301 SkOpSegment* writableSeg = const_cast<SkOpSegment*>(testSeg);
302 SkOpPtT* oppStart = writableSeg->addT(t, nullptr); 302 SkOpPtT* oppStart = writableSeg->addT(t);
303 SkOpSpan* writableBase = const_cast<SkOpSpan*>(base); 303 SkOpSpan* writableBase = const_cast<SkOpSpan*>(base);
304 oppStart->span()->addOppAndMerge(writableBase); 304 oppStart->span()->addOppAndMerge(writableBase);
305 if (oppStart->deleted()) { 305 if (oppStart->deleted()) {
306 continue; 306 continue;
307 } 307 }
308 SkOpSegment* coinSeg = base->segment(); 308 SkOpSegment* coinSeg = base->segment();
309 SkOpSegment* oppSeg = oppStart->segment(); 309 SkOpSegment* oppSeg = oppStart->segment();
310 double coinTs, coinTe, oppTs, oppTe; 310 double coinTs, coinTe, oppTs, oppTe;
311 if (coinSeg < oppSeg) { 311 if (coinSeg < oppSeg) {
312 coinTs = base->t(); 312 coinTs = base->t();
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 const SkOpPtT* oeExisting = !oe ? oppSeg->existing(oppTe, nullptr) : nullptr ; 661 const SkOpPtT* oeExisting = !oe ? oppSeg->existing(oppTe, nullptr) : nullptr ;
662 RETURN_FALSE_IF(callerAborts, osExisting && osExisting == oeExisting); 662 RETURN_FALSE_IF(callerAborts, osExisting && osExisting == oeExisting);
663 RETURN_FALSE_IF(callerAborts, osExisting && (osExisting == oe || 663 RETURN_FALSE_IF(callerAborts, osExisting && (osExisting == oe ||
664 osExisting->contains(oeExisting ? oeExisting : oe))); 664 osExisting->contains(oeExisting ? oeExisting : oe)));
665 RETURN_FALSE_IF(callerAborts, oeExisting && (oeExisting == os || 665 RETURN_FALSE_IF(callerAborts, oeExisting && (oeExisting == os ||
666 oeExisting->contains(osExisting ? osExisting : os))); 666 oeExisting->contains(osExisting ? osExisting : os)));
667 // extra line in debug code 667 // extra line in debug code
668 this->debugValidate(); 668 this->debugValidate();
669 if (!cs || !os) { 669 if (!cs || !os) {
670 SkOpPtT* csWritable = cs ? const_cast<SkOpPtT*>(cs) 670 SkOpPtT* csWritable = cs ? const_cast<SkOpPtT*>(cs)
671 : coinSeg->addT(coinTs, nullptr); 671 : coinSeg->addT(coinTs);
672 SkOpPtT* osWritable = os ? const_cast<SkOpPtT*>(os) 672 SkOpPtT* osWritable = os ? const_cast<SkOpPtT*>(os)
673 : oppSeg->addT(oppTs, nullptr); 673 : oppSeg->addT(oppTs);
674 RETURN_FALSE_IF(callerAborts, !csWritable || !osWritable); 674 RETURN_FALSE_IF(callerAborts, !csWritable || !osWritable);
675 csWritable->span()->addOppAndMerge(osWritable->span()); 675 csWritable->span()->addOppAndMerge(osWritable->span());
676 cs = csWritable; 676 cs = csWritable;
677 os = osWritable; 677 os = osWritable;
678 RETURN_FALSE_IF(callerAborts, (ce && ce->deleted()) || (oe && oe->delete d())); 678 RETURN_FALSE_IF(callerAborts, (ce && ce->deleted()) || (oe && oe->delete d()));
679 } 679 }
680 if (!ce || !oe) { 680 if (!ce || !oe) {
681 SkOpPtT* ceWritable = ce ? const_cast<SkOpPtT*>(ce) 681 SkOpPtT* ceWritable = ce ? const_cast<SkOpPtT*>(ce)
682 : coinSeg->addT(coinTe, nullptr); 682 : coinSeg->addT(coinTe);
683 SkOpPtT* oeWritable = oe ? const_cast<SkOpPtT*>(oe) 683 SkOpPtT* oeWritable = oe ? const_cast<SkOpPtT*>(oe)
684 : oppSeg->addT(oppTe, nullptr); 684 : oppSeg->addT(oppTe);
685 ceWritable->span()->addOppAndMerge(oeWritable->span()); 685 ceWritable->span()->addOppAndMerge(oeWritable->span());
686 ce = ceWritable; 686 ce = ceWritable;
687 oe = oeWritable; 687 oe = oeWritable;
688 } 688 }
689 this->debugValidate(); 689 this->debugValidate();
690 RETURN_FALSE_IF(callerAborts, cs->deleted()); 690 RETURN_FALSE_IF(callerAborts, cs->deleted());
691 RETURN_FALSE_IF(callerAborts, os->deleted()); 691 RETURN_FALSE_IF(callerAborts, os->deleted());
692 RETURN_FALSE_IF(callerAborts, ce->deleted()); 692 RETURN_FALSE_IF(callerAborts, ce->deleted());
693 RETURN_FALSE_IF(callerAborts, oe->deleted()); 693 RETURN_FALSE_IF(callerAborts, oe->deleted());
694 RETURN_FALSE_IF(callerAborts, cs->contains(ce) || os->contains(oe)); 694 RETURN_FALSE_IF(callerAborts, cs->contains(ce) || os->contains(oe));
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1447 this->release(fHead, coin); 1447 this->release(fHead, coin);
1448 } 1448 }
1449 } while ((coin = coin->next())); 1449 } while ((coin = coin->next()));
1450 } 1450 }
1451 1451
1452 bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, const S kOpPtT* testS, 1452 bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, const S kOpPtT* testS,
1453 const SkOpPtT* testE) const { 1453 const SkOpPtT* testE) const {
1454 return testS->segment()->testForCoincidence(testS, testE, testS->span(), 1454 return testS->segment()->testForCoincidence(testS, testE, testS->span(),
1455 testE->span(), outer->coinPtTStart()->segment()); 1455 testE->span(), outer->coinPtTStart()->segment());
1456 } 1456 }
OLDNEW
« no previous file with comments | « src/pathops/SkAddIntersections.cpp ('k') | src/pathops/SkOpSegment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698