| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkMatrix_DEFINED | 10 #ifndef SkMatrix_DEFINED |
| (...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 unsigned mask = 0; | 729 unsigned mask = 0; |
| 730 if (sx != 1 || sy != 1) { | 730 if (sx != 1 || sy != 1) { |
| 731 mask |= kScale_Mask; | 731 mask |= kScale_Mask; |
| 732 } | 732 } |
| 733 if (tx || ty) { | 733 if (tx || ty) { |
| 734 mask |= kTranslate_Mask; | 734 mask |= kTranslate_Mask; |
| 735 } | 735 } |
| 736 this->setTypeMask(mask | kRectStaysRect_Mask); | 736 this->setTypeMask(mask | kRectStaysRect_Mask); |
| 737 } | 737 } |
| 738 | 738 |
| 739 /** |
| 740 * Are all elements of the matrix finite? |
| 741 */ |
| 742 bool isFinite() const { return SkScalarsAreFinite(fMat, 9); } |
| 743 |
| 739 private: | 744 private: |
| 740 enum { | 745 enum { |
| 741 /** Set if the matrix will map a rectangle to another rectangle. This | 746 /** Set if the matrix will map a rectangle to another rectangle. This |
| 742 can be true if the matrix is scale-only, or rotates a multiple of | 747 can be true if the matrix is scale-only, or rotates a multiple of |
| 743 90 degrees. | 748 90 degrees. |
| 744 | 749 |
| 745 This bit will be set on identity matrices | 750 This bit will be set on identity matrices |
| 746 */ | 751 */ |
| 747 kRectStaysRect_Mask = 0x10, | 752 kRectStaysRect_Mask = 0x10, |
| 748 | 753 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 761 kAllMasks = kTranslate_Mask | | 766 kAllMasks = kTranslate_Mask | |
| 762 kScale_Mask | | 767 kScale_Mask | |
| 763 kAffine_Mask | | 768 kAffine_Mask | |
| 764 kPerspective_Mask | | 769 kPerspective_Mask | |
| 765 kRectStaysRect_Mask | 770 kRectStaysRect_Mask |
| 766 }; | 771 }; |
| 767 | 772 |
| 768 SkScalar fMat[9]; | 773 SkScalar fMat[9]; |
| 769 mutable uint32_t fTypeMask; | 774 mutable uint32_t fTypeMask; |
| 770 | 775 |
| 771 /** Are all elements of the matrix finite? | |
| 772 */ | |
| 773 bool isFinite() const { return SkScalarsAreFinite(fMat, 9); } | |
| 774 | |
| 775 static void ComputeInv(SkScalar dst[9], const SkScalar src[9], double invDet
, bool isPersp); | 776 static void ComputeInv(SkScalar dst[9], const SkScalar src[9], double invDet
, bool isPersp); |
| 776 | 777 |
| 777 uint8_t computeTypeMask() const; | 778 uint8_t computeTypeMask() const; |
| 778 uint8_t computePerspectiveTypeMask() const; | 779 uint8_t computePerspectiveTypeMask() const; |
| 779 | 780 |
| 780 void setTypeMask(int mask) { | 781 void setTypeMask(int mask) { |
| 781 // allow kUnknown or a valid mask | 782 // allow kUnknown or a valid mask |
| 782 SkASSERT(kUnknown_Mask == mask || (mask & kAllMasks) == mask || | 783 SkASSERT(kUnknown_Mask == mask || (mask & kAllMasks) == mask || |
| 783 ((kUnknown_Mask | kOnlyPerspectiveValid_Mask) & mask) | 784 ((kUnknown_Mask | kOnlyPerspectiveValid_Mask) & mask) |
| 784 == (kUnknown_Mask | kOnlyPerspectiveValid_Mask)); | 785 == (kUnknown_Mask | kOnlyPerspectiveValid_Mask)); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 static void Affine_vpts(const SkMatrix&, SkPoint dst[], const SkPoint[], int
); | 841 static void Affine_vpts(const SkMatrix&, SkPoint dst[], const SkPoint[], int
); |
| 841 | 842 |
| 842 static const MapPtsProc gMapPtsProcs[]; | 843 static const MapPtsProc gMapPtsProcs[]; |
| 843 | 844 |
| 844 friend class SkPerspIter; | 845 friend class SkPerspIter; |
| 845 friend class SkMatrixPriv; | 846 friend class SkMatrixPriv; |
| 846 }; | 847 }; |
| 847 SK_END_REQUIRE_DENSE | 848 SK_END_REQUIRE_DENSE |
| 848 | 849 |
| 849 #endif | 850 #endif |
| OLD | NEW |