OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 } | 564 } |
565 if (baseAngle) { | 565 if (baseAngle) { |
566 ComputeOneSumReverse(baseAngle, angle, includeType); | 566 ComputeOneSumReverse(baseAngle, angle, includeType); |
567 baseAngle = SK_MinS32 != angle->starter()->windSum() ? angle : n
ullptr; | 567 baseAngle = SK_MinS32 != angle->starter()->windSum() ? angle : n
ullptr; |
568 } | 568 } |
569 } while (prior != firstAngle); | 569 } while (prior != firstAngle); |
570 } | 570 } |
571 return start->starter(end)->windSum(); | 571 return start->starter(end)->windSum(); |
572 } | 572 } |
573 | 573 |
574 void SkOpSegment::detach(const SkOpSpan* span) { | 574 void SkOpSegment::release(const SkOpSpan* span) { |
575 if (span->done()) { | 575 if (span->done()) { |
576 --fDoneCount; | 576 --fDoneCount; |
577 } | 577 } |
578 --fCount; | 578 --fCount; |
579 SkASSERT(fCount >= fDoneCount); | 579 SkASSERT(fCount >= fDoneCount); |
580 } | 580 } |
581 | 581 |
582 double SkOpSegment::distSq(double t, const SkOpAngle* oppAngle) const { | 582 double SkOpSegment::distSq(double t, const SkOpAngle* oppAngle) const { |
583 SkDPoint testPt = this->dPtAtT(t); | 583 SkDPoint testPt = this->dPtAtT(t); |
584 SkDLine testPerp = {{ testPt, testPt }}; | 584 SkDLine testPerp = {{ testPt, testPt }}; |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1400 | 1400 |
1401 // Move nearby t values and pts so they all hang off the same span. Alignment ha
ppens later. | 1401 // Move nearby t values and pts so they all hang off the same span. Alignment ha
ppens later. |
1402 void SkOpSegment::moveNearby() { | 1402 void SkOpSegment::moveNearby() { |
1403 debugValidate(); | 1403 debugValidate(); |
1404 SkOpSpanBase* spanS = &fHead; | 1404 SkOpSpanBase* spanS = &fHead; |
1405 do { | 1405 do { |
1406 SkOpSpanBase* test = spanS->upCast()->next(); | 1406 SkOpSpanBase* test = spanS->upCast()->next(); |
1407 SkOpSpanBase* next; | 1407 SkOpSpanBase* next; |
1408 if (spanS->contains(test)) { | 1408 if (spanS->contains(test)) { |
1409 if (!test->final()) { | 1409 if (!test->final()) { |
1410 test->upCast()->detach(spanS->ptT()); | 1410 test->upCast()->release(spanS->ptT()); |
1411 continue; | 1411 continue; |
1412 } else if (spanS != &fHead) { | 1412 } else if (spanS != &fHead) { |
1413 spanS->upCast()->detach(test->ptT()); | 1413 spanS->upCast()->release(test->ptT()); |
1414 spanS = test; | 1414 spanS = test; |
1415 continue; | 1415 continue; |
1416 } | 1416 } |
1417 } | 1417 } |
1418 do { // iterate through all spans associated with start | 1418 do { // iterate through all spans associated with start |
1419 SkOpPtT* startBase = spanS->ptT(); | 1419 SkOpPtT* startBase = spanS->ptT(); |
1420 next = test->final() ? nullptr : test->upCast()->next(); | 1420 next = test->final() ? nullptr : test->upCast()->next(); |
1421 do { | 1421 do { |
1422 SkOpPtT* testBase = test->ptT(); | 1422 SkOpPtT* testBase = test->ptT(); |
1423 do { | 1423 do { |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1778 int absOut = SkTAbs(outerWinding); | 1778 int absOut = SkTAbs(outerWinding); |
1779 int absIn = SkTAbs(innerWinding); | 1779 int absIn = SkTAbs(innerWinding); |
1780 bool result = absOut == absIn ? outerWinding < 0 : absOut < absIn; | 1780 bool result = absOut == absIn ? outerWinding < 0 : absOut < absIn; |
1781 return result; | 1781 return result; |
1782 } | 1782 } |
1783 | 1783 |
1784 int SkOpSegment::windSum(const SkOpAngle* angle) const { | 1784 int SkOpSegment::windSum(const SkOpAngle* angle) const { |
1785 const SkOpSpan* minSpan = angle->start()->starter(angle->end()); | 1785 const SkOpSpan* minSpan = angle->start()->starter(angle->end()); |
1786 return minSpan->windSum(); | 1786 return minSpan->windSum(); |
1787 } | 1787 } |
OLD | NEW |