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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 } | 380 } |
381 | 381 |
382 // Please keep this in sync with debugInsertCoincidence() | 382 // Please keep this in sync with debugInsertCoincidence() |
383 bool SkOpSpan::insertCoincidence(const SkOpSegment* segment, bool flipped) { | 383 bool SkOpSpan::insertCoincidence(const SkOpSegment* segment, bool flipped) { |
384 if (this->containsCoincidence(segment)) { | 384 if (this->containsCoincidence(segment)) { |
385 return true; | 385 return true; |
386 } | 386 } |
387 SkOpPtT* next = &fPtT; | 387 SkOpPtT* next = &fPtT; |
388 while ((next = next->next()) != &fPtT) { | 388 while ((next = next->next()) != &fPtT) { |
389 if (next->segment() == segment) { | 389 if (next->segment() == segment) { |
390 SkOpSpan* span = flipped ? next->span()->prev() : next->span()->upCa
st(); | 390 SkOpSpan* span; |
391 if (!span) { | 391 if (flipped) { |
392 return false; | 392 span = next->span()->prev(); |
| 393 if (!span) { |
| 394 return false; |
| 395 } |
| 396 } else { |
| 397 SkOpSpanBase* base = next->span(); |
| 398 if (!base->upCastable()) { |
| 399 return false; |
| 400 } |
| 401 span = base->upCast(); |
393 } | 402 } |
394 this->insertCoincidence(span); | 403 this->insertCoincidence(span); |
395 return true; | 404 return true; |
396 } | 405 } |
397 } | 406 } |
398 #if DEBUG_COINCIDENCE | 407 #if DEBUG_COINCIDENCE |
399 SkASSERT(0); // FIXME? if we get here, the span is missing its opposite segm
ent... | 408 SkASSERT(0); // FIXME? if we get here, the span is missing its opposite segm
ent... |
400 #endif | 409 #endif |
401 return true; | 410 return true; |
402 } | 411 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 | 448 |
440 void SkOpSpan::setWindSum(int windSum) { | 449 void SkOpSpan::setWindSum(int windSum) { |
441 SkASSERT(!final()); | 450 SkASSERT(!final()); |
442 if (fWindSum != SK_MinS32 && fWindSum != windSum) { | 451 if (fWindSum != SK_MinS32 && fWindSum != windSum) { |
443 this->globalState()->setWindingFailed(); | 452 this->globalState()->setWindingFailed(); |
444 return; | 453 return; |
445 } | 454 } |
446 SkASSERT(!DEBUG_LIMIT_WIND_SUM || SkTAbs(windSum) <= DEBUG_LIMIT_WIND_SUM); | 455 SkASSERT(!DEBUG_LIMIT_WIND_SUM || SkTAbs(windSum) <= DEBUG_LIMIT_WIND_SUM); |
447 fWindSum = windSum; | 456 fWindSum = windSum; |
448 } | 457 } |
OLD | NEW |