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

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

Issue 2275703003: remove point aliases (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 for (int index = 0; index < i.used(); ++index) { 298 for (int index = 0; index < i.used(); ++index) {
299 double t = i[0][index]; 299 double t = i[0][index];
300 if (!between(0, t, 1)) { 300 if (!between(0, t, 1)) {
301 continue; 301 continue;
302 } 302 }
303 SkDPoint oppPt = i.pt(index); 303 SkDPoint oppPt = i.pt(index);
304 if (!oppPt.approximatelyEqual(pt)) { 304 if (!oppPt.approximatelyEqual(pt)) {
305 continue; 305 continue;
306 } 306 }
307 SkOpSegment* writableSeg = const_cast<SkOpSegment*>(testSeg); 307 SkOpSegment* writableSeg = const_cast<SkOpSegment*>(testSeg);
308 SkOpPtT* oppStart = writableSeg->addT(t, SkOpSegment::kAllowAliasMat ch, nullptr); 308 SkOpPtT* oppStart = writableSeg->addT(t, nullptr);
309 SkOpSpan* writableBase = const_cast<SkOpSpan*>(base); 309 SkOpSpan* writableBase = const_cast<SkOpSpan*>(base);
310 oppStart->span()->addOppAndMerge(writableBase); 310 oppStart->span()->addOppAndMerge(writableBase);
311 if (oppStart->deleted()) { 311 if (oppStart->deleted()) {
312 continue; 312 continue;
313 } 313 }
314 SkOpSegment* coinSeg = base->segment(); 314 SkOpSegment* coinSeg = base->segment();
315 SkOpSegment* oppSeg = oppStart->segment(); 315 SkOpSegment* oppSeg = oppStart->segment();
316 double coinTs, coinTe, oppTs, oppTe; 316 double coinTs, coinTe, oppTs, oppTe;
317 if (coinSeg < oppSeg) { 317 if (coinSeg < oppSeg) {
318 coinTs = base->t(); 318 coinTs = base->t();
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 if (osExisting && (osExisting == oe || osExisting->contains(oeExisting ? oeE xisting : oe))) { 684 if (osExisting && (osExisting == oe || osExisting->contains(oeExisting ? oeE xisting : oe))) {
685 return false; 685 return false;
686 } 686 }
687 if (oeExisting && (oeExisting == os || oeExisting->contains(osExisting ? osE xisting : os))) { 687 if (oeExisting && (oeExisting == os || oeExisting->contains(osExisting ? osE xisting : os))) {
688 return false; 688 return false;
689 } 689 }
690 // extra line in debug code 690 // extra line in debug code
691 this->debugValidate(); 691 this->debugValidate();
692 if (!cs || !os) { 692 if (!cs || !os) {
693 SkOpPtT* csWritable = cs ? const_cast<SkOpPtT*>(cs) 693 SkOpPtT* csWritable = cs ? const_cast<SkOpPtT*>(cs)
694 : coinSeg->addT(coinTs, SkOpSegment::kNoAliasMatch, nullptr); 694 : coinSeg->addT(coinTs, nullptr);
695 SkOpPtT* osWritable = os ? const_cast<SkOpPtT*>(os) 695 SkOpPtT* osWritable = os ? const_cast<SkOpPtT*>(os)
696 : oppSeg->addT(oppTs, SkOpSegment::kNoAliasMatch, nullptr); 696 : oppSeg->addT(oppTs, nullptr);
697 if (!csWritable || !osWritable) { 697 if (!csWritable || !osWritable) {
698 return false; 698 return false;
699 } 699 }
700 csWritable->span()->addOppAndMerge(osWritable->span()); 700 csWritable->span()->addOppAndMerge(osWritable->span());
701 cs = csWritable; 701 cs = csWritable;
702 os = osWritable; 702 os = osWritable;
703 if ((ce && ce->deleted()) || (oe && oe->deleted())) { 703 if ((ce && ce->deleted()) || (oe && oe->deleted())) {
704 return false; 704 return false;
705 } 705 }
706 } 706 }
707 if (!ce || !oe) { 707 if (!ce || !oe) {
708 SkOpPtT* ceWritable = ce ? const_cast<SkOpPtT*>(ce) 708 SkOpPtT* ceWritable = ce ? const_cast<SkOpPtT*>(ce)
709 : coinSeg->addT(coinTe, SkOpSegment::kNoAliasMatch, nullptr); 709 : coinSeg->addT(coinTe, nullptr);
710 SkOpPtT* oeWritable = oe ? const_cast<SkOpPtT*>(oe) 710 SkOpPtT* oeWritable = oe ? const_cast<SkOpPtT*>(oe)
711 : oppSeg->addT(oppTe, SkOpSegment::kNoAliasMatch, nullptr); 711 : oppSeg->addT(oppTe, nullptr);
712 ceWritable->span()->addOppAndMerge(oeWritable->span()); 712 ceWritable->span()->addOppAndMerge(oeWritable->span());
713 ce = ceWritable; 713 ce = ceWritable;
714 oe = oeWritable; 714 oe = oeWritable;
715 } 715 }
716 this->debugValidate(); 716 this->debugValidate();
717 if (cs->deleted() || os->deleted() || ce->deleted() || oe->deleted()) { 717 if (cs->deleted() || os->deleted() || ce->deleted() || oe->deleted()) {
718 return false; 718 return false;
719 } 719 }
720 if (cs->contains(ce) || os->contains(oe)) { 720 if (cs->contains(ce) || os->contains(oe)) {
721 return false; 721 return false;
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 this->release(fHead, coin); 1475 this->release(fHead, coin);
1476 } 1476 }
1477 } while ((coin = coin->next())); 1477 } while ((coin = coin->next()));
1478 } 1478 }
1479 1479
1480 bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, const S kOpPtT* testS, 1480 bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, const S kOpPtT* testS,
1481 const SkOpPtT* testE) const { 1481 const SkOpPtT* testE) const {
1482 return testS->segment()->testForCoincidence(testS, testE, testS->span(), 1482 return testS->segment()->testForCoincidence(testS, testE, testS->span(),
1483 testE->span(), outer->coinPtTStart()->segment()); 1483 testE->span(), outer->coinPtTStart()->segment());
1484 } 1484 }
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