OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 | 7 |
8 #include "SkBuffer.h" | 8 #include "SkBuffer.h" |
9 #include "SkErrorInternals.h" | 9 #include "SkErrorInternals.h" |
10 #include "SkGeometry.h" | 10 #include "SkGeometry.h" |
(...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1653 // Set the first return pt to the last pt of the previous primitive. | 1653 // Set the first return pt to the last pt of the previous primitive. |
1654 return fPts[-1]; | 1654 return fPts[-1]; |
1655 } | 1655 } |
1656 } | 1656 } |
1657 | 1657 |
1658 void SkPath::Iter::consumeDegenerateSegments() { | 1658 void SkPath::Iter::consumeDegenerateSegments() { |
1659 // We need to step over anything that will not move the current draw point | 1659 // We need to step over anything that will not move the current draw point |
1660 // forward before the next move is seen | 1660 // forward before the next move is seen |
1661 const uint8_t* lastMoveVerb = 0; | 1661 const uint8_t* lastMoveVerb = 0; |
1662 const SkPoint* lastMovePt = 0; | 1662 const SkPoint* lastMovePt = 0; |
| 1663 const SkScalar* lastMoveWeight = NULL; |
1663 SkPoint lastPt = fLastPt; | 1664 SkPoint lastPt = fLastPt; |
1664 while (fVerbs != fVerbStop) { | 1665 while (fVerbs != fVerbStop) { |
1665 unsigned verb = *(fVerbs - 1); // fVerbs is one beyond the current verb | 1666 unsigned verb = *(fVerbs - 1); // fVerbs is one beyond the current verb |
1666 switch (verb) { | 1667 switch (verb) { |
1667 case kMove_Verb: | 1668 case kMove_Verb: |
1668 // Keep a record of this most recent move | 1669 // Keep a record of this most recent move |
1669 lastMoveVerb = fVerbs; | 1670 lastMoveVerb = fVerbs; |
1670 lastMovePt = fPts; | 1671 lastMovePt = fPts; |
| 1672 lastMoveWeight = fConicWeights; |
1671 lastPt = fPts[0]; | 1673 lastPt = fPts[0]; |
1672 fVerbs--; | 1674 fVerbs--; |
1673 fPts++; | 1675 fPts++; |
1674 break; | 1676 break; |
1675 | 1677 |
1676 case kClose_Verb: | 1678 case kClose_Verb: |
1677 // A close when we are in a segment is always valid except when
it | 1679 // A close when we are in a segment is always valid except when
it |
1678 // follows a move which follows a segment. | 1680 // follows a move which follows a segment. |
1679 if (fSegmentState == kAfterPrimitive_SegmentState && !lastMoveVe
rb) { | 1681 if (fSegmentState == kAfterPrimitive_SegmentState && !lastMoveVe
rb) { |
1680 return; | 1682 return; |
1681 } | 1683 } |
1682 // A close at any other time must be ignored | 1684 // A close at any other time must be ignored |
1683 fVerbs--; | 1685 fVerbs--; |
1684 break; | 1686 break; |
1685 | 1687 |
1686 case kLine_Verb: | 1688 case kLine_Verb: |
1687 if (!IsLineDegenerate(lastPt, fPts[0])) { | 1689 if (!IsLineDegenerate(lastPt, fPts[0])) { |
1688 if (lastMoveVerb) { | 1690 if (lastMoveVerb) { |
1689 fVerbs = lastMoveVerb; | 1691 fVerbs = lastMoveVerb; |
1690 fPts = lastMovePt; | 1692 fPts = lastMovePt; |
| 1693 fConicWeights = lastMoveWeight; |
1691 return; | 1694 return; |
1692 } | 1695 } |
1693 return; | 1696 return; |
1694 } | 1697 } |
1695 // Ignore this line and continue | 1698 // Ignore this line and continue |
1696 fVerbs--; | 1699 fVerbs--; |
1697 fPts++; | 1700 fPts++; |
1698 break; | 1701 break; |
1699 | 1702 |
1700 case kConic_Verb: | 1703 case kConic_Verb: |
1701 case kQuad_Verb: | 1704 case kQuad_Verb: |
1702 if (!IsQuadDegenerate(lastPt, fPts[0], fPts[1])) { | 1705 if (!IsQuadDegenerate(lastPt, fPts[0], fPts[1])) { |
1703 if (lastMoveVerb) { | 1706 if (lastMoveVerb) { |
1704 fVerbs = lastMoveVerb; | 1707 fVerbs = lastMoveVerb; |
1705 fPts = lastMovePt; | 1708 fPts = lastMovePt; |
| 1709 fConicWeights = lastMoveWeight; |
1706 return; | 1710 return; |
1707 } | 1711 } |
1708 return; | 1712 return; |
1709 } | 1713 } |
1710 // Ignore this line and continue | 1714 // Ignore this line and continue |
1711 fVerbs--; | 1715 fVerbs--; |
1712 fPts += 2; | 1716 fPts += 2; |
1713 fConicWeights += (kConic_Verb == verb); | 1717 fConicWeights += (kConic_Verb == verb); |
1714 break; | 1718 break; |
1715 | 1719 |
1716 case kCubic_Verb: | 1720 case kCubic_Verb: |
1717 if (!IsCubicDegenerate(lastPt, fPts[0], fPts[1], fPts[2])) { | 1721 if (!IsCubicDegenerate(lastPt, fPts[0], fPts[1], fPts[2])) { |
1718 if (lastMoveVerb) { | 1722 if (lastMoveVerb) { |
1719 fVerbs = lastMoveVerb; | 1723 fVerbs = lastMoveVerb; |
1720 fPts = lastMovePt; | 1724 fPts = lastMovePt; |
| 1725 fConicWeights = lastMoveWeight; |
1721 return; | 1726 return; |
1722 } | 1727 } |
1723 return; | 1728 return; |
1724 } | 1729 } |
1725 // Ignore this line and continue | 1730 // Ignore this line and continue |
1726 fVerbs--; | 1731 fVerbs--; |
1727 fPts += 3; | 1732 fPts += 3; |
1728 break; | 1733 break; |
1729 | 1734 |
1730 default: | 1735 default: |
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2786 switch (this->getFillType()) { | 2791 switch (this->getFillType()) { |
2787 case SkPath::kEvenOdd_FillType: | 2792 case SkPath::kEvenOdd_FillType: |
2788 case SkPath::kInverseEvenOdd_FillType: | 2793 case SkPath::kInverseEvenOdd_FillType: |
2789 w &= 1; | 2794 w &= 1; |
2790 break; | 2795 break; |
2791 default: | 2796 default: |
2792 break; | 2797 break; |
2793 } | 2798 } |
2794 return SkToBool(w); | 2799 return SkToBool(w); |
2795 } | 2800 } |
OLD | NEW |