| OLD | NEW |
| 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 fWindSum = fOppSum = SK_MinS32; | 452 fWindSum = fOppSum = SK_MinS32; |
| 453 fWindValue = 1; | 453 fWindValue = 1; |
| 454 fOppValue = 0; | 454 fOppValue = 0; |
| 455 fTopTTry = 0; | 455 fTopTTry = 0; |
| 456 fChased = fDone = false; | 456 fChased = fDone = false; |
| 457 segment->bumpCount(); | 457 segment->bumpCount(); |
| 458 fAlreadyAdded = false; | 458 fAlreadyAdded = false; |
| 459 } | 459 } |
| 460 | 460 |
| 461 // Please keep this in sync with debugInsertCoincidence() | 461 // Please keep this in sync with debugInsertCoincidence() |
| 462 bool SkOpSpan::insertCoincidence(const SkOpSegment* segment, bool flipped) { | 462 bool SkOpSpan::insertCoincidence(const SkOpSegment* segment, bool flipped, bool
ordered) { |
| 463 if (this->containsCoincidence(segment)) { | 463 if (this->containsCoincidence(segment)) { |
| 464 return true; | 464 return true; |
| 465 } | 465 } |
| 466 SkOpPtT* next = &fPtT; | 466 SkOpPtT* next = &fPtT; |
| 467 while ((next = next->next()) != &fPtT) { | 467 while ((next = next->next()) != &fPtT) { |
| 468 if (next->segment() == segment) { | 468 if (next->segment() == segment) { |
| 469 SkOpSpan* span; | 469 SkOpSpan* span; |
| 470 if (flipped) { | 470 SkOpSpanBase* base = next->span(); |
| 471 span = next->span()->prev(); | 471 if (!ordered) { |
| 472 if (!span) { | 472 const SkOpSpanBase* spanEnd = fNext->contains(segment)->span(); |
| 473 return false; | 473 const SkOpPtT* start = base->ptT()->starter(spanEnd->ptT()); |
| 474 } | 474 span = const_cast<SkOpSpan*>(start->span()->upCast()); |
| 475 } else if (flipped) { |
| 476 span = base->prev(); |
| 477 FAIL_IF(!span); |
| 475 } else { | 478 } else { |
| 476 SkOpSpanBase* base = next->span(); | 479 FAIL_IF(!base->upCastable()); |
| 477 if (!base->upCastable()) { | |
| 478 return false; | |
| 479 } | |
| 480 span = base->upCast(); | 480 span = base->upCast(); |
| 481 } | 481 } |
| 482 this->insertCoincidence(span); | 482 this->insertCoincidence(span); |
| 483 return true; | 483 return true; |
| 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; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |