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

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

Issue 2348263002: fix fuzzer bugs (Closed)
Patch Set: 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 | « no previous file | tests/PathOpsOpTest.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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 SkASSERT(0); // may assert if coincident span isn't fully processed 165 SkASSERT(0); // may assert if coincident span isn't fully processed
166 continue; 166 continue;
167 } 167 }
168 if ((oppLastT > opp->fT) != flipped) { 168 if ((oppLastT > opp->fT) != flipped) {
169 return false; 169 return false;
170 } 170 }
171 oppLastT = opp->fT; 171 oppLastT = opp->fT;
172 if (next == end) { 172 if (next == end) {
173 break; 173 break;
174 } 174 }
175 if (!next->upCastable()) {
176 return false;
177 }
175 next = next->upCast()->next(); 178 next = next->upCast()->next();
176 } while (true); 179 } while (true);
177 return true; 180 return true;
178 } 181 }
179 182
180 // returns true if the point is on a coincident edge, and if it is the start of that edge 183 // returns true if the point is on a coincident edge, and if it is the start of that edge
181 bool SkOpCoincidence::edge(const SkOpPtT* test, bool* start) const { 184 bool SkOpCoincidence::edge(const SkOpPtT* test, bool* start) const {
182 SkCoincidentSpans* coinRec = fHead; 185 SkCoincidentSpans* coinRec = fHead;
183 if (!coinRec) { 186 if (!coinRec) {
184 return false; 187 return false;
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 bool SkOpCoincidence::addExpanded() { 445 bool SkOpCoincidence::addExpanded() {
443 SkCoincidentSpans* coin = this->fHead; 446 SkCoincidentSpans* coin = this->fHead;
444 if (!coin) { 447 if (!coin) {
445 return true; 448 return true;
446 } 449 }
447 do { 450 do {
448 const SkOpPtT* startPtT = coin->coinPtTStart(); 451 const SkOpPtT* startPtT = coin->coinPtTStart();
449 const SkOpPtT* oStartPtT = coin->oppPtTStart(); 452 const SkOpPtT* oStartPtT = coin->oppPtTStart();
450 double priorT = startPtT->fT; 453 double priorT = startPtT->fT;
451 double oPriorT = oStartPtT->fT; 454 double oPriorT = oStartPtT->fT;
452 SkASSERT(startPtT->contains(oStartPtT)); 455 FAIL_IF(!startPtT->contains(oStartPtT));
453 SkOPASSERT(coin->coinPtTEnd()->contains(coin->oppPtTEnd())); 456 SkOPASSERT(coin->coinPtTEnd()->contains(coin->oppPtTEnd()));
454 const SkOpSpanBase* start = startPtT->span(); 457 const SkOpSpanBase* start = startPtT->span();
455 const SkOpSpanBase* oStart = oStartPtT->span(); 458 const SkOpSpanBase* oStart = oStartPtT->span();
456 const SkOpSpanBase* end = coin->coinPtTEnd()->span(); 459 const SkOpSpanBase* end = coin->coinPtTEnd()->span();
457 const SkOpSpanBase* oEnd = coin->oppPtTEnd()->span(); 460 const SkOpSpanBase* oEnd = coin->oppPtTEnd()->span();
458 FAIL_IF(oEnd->deleted()); 461 FAIL_IF(oEnd->deleted());
459 FAIL_IF(!start->upCastable()); 462 FAIL_IF(!start->upCastable());
460 const SkOpSpanBase* test = start->upCast()->next(); 463 const SkOpSpanBase* test = start->upCast()->next();
461 const SkOpSpanBase* oTest = coin->flipped() ? oStart->prev() : oStart->u pCast()->next(); 464 const SkOpSpanBase* oTest = coin->flipped() ? oStart->prev() : oStart->u pCast()->next();
462 FAIL_IF(!oTest); 465 FAIL_IF(!oTest);
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1600 this->release(fHead, coin); 1603 this->release(fHead, coin);
1601 } 1604 }
1602 } while ((coin = coin->next())); 1605 } while ((coin = coin->next()));
1603 } 1606 }
1604 1607
1605 bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, const S kOpPtT* testS, 1608 bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, const S kOpPtT* testS,
1606 const SkOpPtT* testE) const { 1609 const SkOpPtT* testE) const {
1607 return testS->segment()->testForCoincidence(testS, testE, testS->span(), 1610 return testS->segment()->testForCoincidence(testS, testE, testS->span(),
1608 testE->span(), outer->coinPtTStart()->segment()); 1611 testE->span(), outer->coinPtTStart()->segment());
1609 } 1612 }
OLDNEW
« no previous file with comments | « no previous file | tests/PathOpsOpTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698