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 "SkMatrix.h" | 8 #include "SkMatrix.h" |
9 #include "SkFloatBits.h" | 9 #include "SkFloatBits.h" |
10 #include "SkRSXform.h" | 10 #include "SkRSXform.h" |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 | 762 |
763 // Since the determinant is on the order of the cube of the matrix members, | 763 // Since the determinant is on the order of the cube of the matrix members, |
764 // compare to the cube of the default nearly-zero constant (although an | 764 // compare to the cube of the default nearly-zero constant (although an |
765 // estimate of the condition number would be better if it wasn't so expensiv
e). | 765 // estimate of the condition number would be better if it wasn't so expensiv
e). |
766 if (SkScalarNearlyZero((float)det, SK_ScalarNearlyZero * SK_ScalarNearlyZero
* SK_ScalarNearlyZero)) { | 766 if (SkScalarNearlyZero((float)det, SK_ScalarNearlyZero * SK_ScalarNearlyZero
* SK_ScalarNearlyZero)) { |
767 return 0; | 767 return 0; |
768 } | 768 } |
769 return 1.0 / det; | 769 return 1.0 / det; |
770 } | 770 } |
771 | 771 |
772 bool SkMatrix::isFinite() const { | |
773 for (int i = 0; i < 9; ++i) { | |
774 if (!SkScalarIsFinite(fMat[i])) { | |
775 return false; | |
776 } | |
777 } | |
778 | |
779 return true; | |
780 } | |
781 | |
782 void SkMatrix::SetAffineIdentity(SkScalar affine[6]) { | 772 void SkMatrix::SetAffineIdentity(SkScalar affine[6]) { |
783 affine[kAScaleX] = 1; | 773 affine[kAScaleX] = 1; |
784 affine[kASkewY] = 0; | 774 affine[kASkewY] = 0; |
785 affine[kASkewX] = 0; | 775 affine[kASkewX] = 0; |
786 affine[kAScaleY] = 1; | 776 affine[kAScaleY] = 1; |
787 affine[kATransX] = 0; | 777 affine[kATransX] = 0; |
788 affine[kATransY] = 0; | 778 affine[kATransY] = 0; |
789 } | 779 } |
790 | 780 |
791 bool SkMatrix::asAffine(SkScalar affine[6]) const { | 781 bool SkMatrix::asAffine(SkScalar affine[6]) const { |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1860 const SkScalar m11 = m00; | 1850 const SkScalar m11 = m00; |
1861 const SkScalar m12 = fTy; | 1851 const SkScalar m12 = fTy; |
1862 | 1852 |
1863 quad[0].set(m02, m12); | 1853 quad[0].set(m02, m12); |
1864 quad[1].set(m00 * width + m02, m10 * width + m12); | 1854 quad[1].set(m00 * width + m02, m10 * width + m12); |
1865 quad[2].set(m00 * width + m01 * height + m02, m10 * width + m11 * height + m
12); | 1855 quad[2].set(m00 * width + m01 * height + m02, m10 * width + m11 * height + m
12); |
1866 quad[3].set(m01 * height + m02, m11 * height + m12); | 1856 quad[3].set(m01 * height + m02, m11 * height + m12); |
1867 #endif | 1857 #endif |
1868 } | 1858 } |
1869 | 1859 |
OLD | NEW |