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

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

Issue 2316173002: fix pathops fuzzers (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 | « src/pathops/SkOpCoincidence.cpp ('k') | 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 2014 Google Inc. 2 * Copyright 2014 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 "SkOpContour.h" 8 #include "SkOpContour.h"
9 #include "SkOpSegment.h" 9 #include "SkOpSegment.h"
10 #include "SkPathWriter.h" 10 #include "SkPathWriter.h"
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 if (inner->deleted()) { 387 if (inner->deleted()) {
388 continue; 388 continue;
389 } 389 }
390 SkOpSpanBase* innerBase = inner->span(); 390 SkOpSpanBase* innerBase = inner->span();
391 SkASSERT(innerBase->ptT() == inner); 391 SkASSERT(innerBase->ptT() == inner);
392 // when the intersection is first detected, the span base is marked if there are 392 // when the intersection is first detected, the span base is marked if there are
393 // more than one point in the intersection. 393 // more than one point in the intersection.
394 if (!zero_or_one(inner->fT)) { 394 if (!zero_or_one(inner->fT)) {
395 innerBase->upCast()->release(test); 395 innerBase->upCast()->release(test);
396 } else { 396 } else {
397 SkASSERT(inner->fT != test->fT); 397 SkOPASSERT(inner->fT != test->fT);
398 if (!zero_or_one(test->fT)) { 398 if (!zero_or_one(test->fT)) {
399 testBase->upCast()->release(inner); 399 testBase->upCast()->release(inner);
400 } else { 400 } else {
401 segment->markAllDone(); // mark segment as collapsed 401 segment->markAllDone(); // mark segment as collapsed
402 SkDEBUGCODE(testBase->debugSetDeleted()); 402 SkDEBUGCODE(testBase->debugSetDeleted());
403 test->setDeleted(); 403 test->setDeleted();
404 SkDEBUGCODE(innerBase->debugSetDeleted()); 404 SkDEBUGCODE(innerBase->debugSetDeleted());
405 inner->setDeleted(); 405 inner->setDeleted();
406 } 406 }
407 } 407 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 } 484 }
485 } 485 }
486 #if DEBUG_COINCIDENCE 486 #if DEBUG_COINCIDENCE
487 SkASSERT(0); // FIXME? if we get here, the span is missing its opposite segm ent... 487 SkASSERT(0); // FIXME? if we get here, the span is missing its opposite segm ent...
488 #endif 488 #endif
489 return true; 489 return true;
490 } 490 }
491 491
492 void SkOpSpan::release(const SkOpPtT* kept) { 492 void SkOpSpan::release(const SkOpPtT* kept) {
493 SkDEBUGCODE(fDebugDeleted = true); 493 SkDEBUGCODE(fDebugDeleted = true);
494 SkASSERT(kept->span() != this); 494 SkOPASSERT(kept->span() != this);
495 SkASSERT(!final()); 495 SkASSERT(!final());
496 SkOpSpan* prev = this->prev(); 496 SkOpSpan* prev = this->prev();
497 SkASSERT(prev); 497 SkASSERT(prev);
498 SkOpSpanBase* next = this->next(); 498 SkOpSpanBase* next = this->next();
499 SkASSERT(next); 499 SkASSERT(next);
500 prev->setNext(next); 500 prev->setNext(next);
501 next->setPrev(prev); 501 next->setPrev(prev);
502 this->segment()->release(this); 502 this->segment()->release(this);
503 SkOpCoincidence* coincidence = this->globalState()->coincidence(); 503 SkOpCoincidence* coincidence = this->globalState()->coincidence();
504 if (coincidence) { 504 if (coincidence) {
(...skipping 22 matching lines...) Expand all
527 527
528 void SkOpSpan::setWindSum(int windSum) { 528 void SkOpSpan::setWindSum(int windSum) {
529 SkASSERT(!final()); 529 SkASSERT(!final());
530 if (fWindSum != SK_MinS32 && fWindSum != windSum) { 530 if (fWindSum != SK_MinS32 && fWindSum != windSum) {
531 this->globalState()->setWindingFailed(); 531 this->globalState()->setWindingFailed();
532 return; 532 return;
533 } 533 }
534 SkASSERT(!DEBUG_LIMIT_WIND_SUM || SkTAbs(windSum) <= DEBUG_LIMIT_WIND_SUM); 534 SkASSERT(!DEBUG_LIMIT_WIND_SUM || SkTAbs(windSum) <= DEBUG_LIMIT_WIND_SUM);
535 fWindSum = windSum; 535 fWindSum = windSum;
536 } 536 }
OLDNEW
« no previous file with comments | « src/pathops/SkOpCoincidence.cpp ('k') | tests/PathOpsOpTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698