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 1129863007: look for deleted pts when detecting line/curve coincident edges (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix path op builder Created 5 years, 7 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/SkOpBuilder.cpp ('k') | src/pathops/SkOpSegment.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 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 return false; 188 return false;
189 } 189 }
190 190
191 // walk span sets in parallel, moving winding from one to the other 191 // walk span sets in parallel, moving winding from one to the other
192 bool SkOpCoincidence::apply() { 192 bool SkOpCoincidence::apply() {
193 SkCoincidentSpans* coin = fHead; 193 SkCoincidentSpans* coin = fHead;
194 if (!coin) { 194 if (!coin) {
195 return true; 195 return true;
196 } 196 }
197 do { 197 do {
198 SkOpSpan* start = coin->fCoinPtTStart->span()->upCast();
199 if (start->deleted()) {
200 continue;
201 }
198 SkOpSpanBase* end = coin->fCoinPtTEnd->span(); 202 SkOpSpanBase* end = coin->fCoinPtTEnd->span();
199 SkOpSpan* start = coin->fCoinPtTStart->span()->upCast();
200 SkASSERT(start == start->starter(end)); 203 SkASSERT(start == start->starter(end));
201 bool flipped = coin->fFlipped; 204 bool flipped = coin->fFlipped;
205 SkOpSpan* oStart = (flipped ? coin->fOppPtTEnd : coin->fOppPtTStart)->sp an()->upCast();
206 if (oStart->deleted()) {
207 continue;
208 }
202 SkOpSpanBase* oEnd = (flipped ? coin->fOppPtTStart : coin->fOppPtTEnd)-> span(); 209 SkOpSpanBase* oEnd = (flipped ? coin->fOppPtTStart : coin->fOppPtTEnd)-> span();
203 SkOpSpan* oStart = (flipped ? coin->fOppPtTEnd : coin->fOppPtTStart)->sp an()->upCast();
204 SkASSERT(oStart == oStart->starter(oEnd)); 210 SkASSERT(oStart == oStart->starter(oEnd));
205 SkOpSegment* segment = start->segment(); 211 SkOpSegment* segment = start->segment();
206 SkOpSegment* oSegment = oStart->segment(); 212 SkOpSegment* oSegment = oStart->segment();
207 bool operandSwap = segment->operand() != oSegment->operand(); 213 bool operandSwap = segment->operand() != oSegment->operand();
208 if (flipped) { 214 if (flipped) {
209 do { 215 do {
210 SkOpSpanBase* oNext = oStart->next(); 216 SkOpSpanBase* oNext = oStart->next();
211 if (oNext == oEnd) { 217 if (oNext == oEnd) {
212 break; 218 break;
213 } 219 }
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 419
414 bool SkOpCoincidence::overlap(const SkOpPtT* coin1s, const SkOpPtT* coin1e, 420 bool SkOpCoincidence::overlap(const SkOpPtT* coin1s, const SkOpPtT* coin1e,
415 const SkOpPtT* coin2s, const SkOpPtT* coin2e, double* overS, double* ove rE) const { 421 const SkOpPtT* coin2s, const SkOpPtT* coin2e, double* overS, double* ove rE) const {
416 if (coin1s->segment() != coin2s->segment()) { 422 if (coin1s->segment() != coin2s->segment()) {
417 return false; 423 return false;
418 } 424 }
419 *overS = SkTMax(SkTMin(coin1s->fT, coin1e->fT), SkTMin(coin2s->fT, coin2e->f T)); 425 *overS = SkTMax(SkTMin(coin1s->fT, coin1e->fT), SkTMin(coin2s->fT, coin2e->f T));
420 *overE = SkTMin(SkTMax(coin1s->fT, coin1e->fT), SkTMax(coin2s->fT, coin2e->f T)); 426 *overE = SkTMin(SkTMax(coin1s->fT, coin1e->fT), SkTMax(coin2s->fT, coin2e->f T));
421 return *overS < *overE; 427 return *overS < *overE;
422 } 428 }
OLDNEW
« no previous file with comments | « src/pathops/SkOpBuilder.cpp ('k') | src/pathops/SkOpSegment.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698