| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 | 7 |
| 8 #include "SkMath.h" | 8 #include "SkMath.h" |
| 9 #include "SkMatrix.h" | 9 #include "SkMatrix.h" |
| 10 #include "SkMatrixUtils.h" | 10 #include "SkMatrixUtils.h" |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 test_flatten(reporter, mat); | 831 test_flatten(reporter, mat); |
| 832 test_flatten(reporter, iden2); | 832 test_flatten(reporter, iden2); |
| 833 | 833 |
| 834 mat.setScale(0, SK_Scalar1); | 834 mat.setScale(0, SK_Scalar1); |
| 835 REPORTER_ASSERT(reporter, !mat.invert(NULL)); | 835 REPORTER_ASSERT(reporter, !mat.invert(NULL)); |
| 836 REPORTER_ASSERT(reporter, !mat.invert(&inverse)); | 836 REPORTER_ASSERT(reporter, !mat.invert(&inverse)); |
| 837 mat.setScale(SK_Scalar1, 0); | 837 mat.setScale(SK_Scalar1, 0); |
| 838 REPORTER_ASSERT(reporter, !mat.invert(NULL)); | 838 REPORTER_ASSERT(reporter, !mat.invert(NULL)); |
| 839 REPORTER_ASSERT(reporter, !mat.invert(&inverse)); | 839 REPORTER_ASSERT(reporter, !mat.invert(&inverse)); |
| 840 | 840 |
| 841 // Inverting this matrix results in a non-finite matrix |
| 842 mat.setAll(0.0f, 1.0f, 2.0f, |
| 843 0.0f, 1.0f, -3.40277175e+38f, |
| 844 1.00003040f, 1.0f, 0.0f); |
| 845 REPORTER_ASSERT(reporter, !mat.invert(NULL)); |
| 846 REPORTER_ASSERT(reporter, !mat.invert(&inverse)); |
| 847 |
| 841 // rectStaysRect test | 848 // rectStaysRect test |
| 842 { | 849 { |
| 843 static const struct { | 850 static const struct { |
| 844 SkScalar m00, m01, m10, m11; | 851 SkScalar m00, m01, m10, m11; |
| 845 bool mStaysRect; | 852 bool mStaysRect; |
| 846 } | 853 } |
| 847 gRectStaysRectSamples[] = { | 854 gRectStaysRectSamples[] = { |
| 848 { 0, 0, 0, 0, false }, | 855 { 0, 0, 0, 0, false }, |
| 849 { 0, 0, 0, SK_Scalar1, false }, | 856 { 0, 0, 0, SK_Scalar1, false }, |
| 850 { 0, 0, SK_Scalar1, 0, false }, | 857 { 0, 0, SK_Scalar1, 0, false }, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 a.setTranslate(10, 20); | 933 a.setTranslate(10, 20); |
| 927 | 934 |
| 928 SkMatrix b; | 935 SkMatrix b; |
| 929 b.setScale(3, 5); | 936 b.setScale(3, 5); |
| 930 | 937 |
| 931 SkMatrix expected; | 938 SkMatrix expected; |
| 932 expected.setConcat(a,b); | 939 expected.setConcat(a,b); |
| 933 | 940 |
| 934 REPORTER_ASSERT(r, expected == SkMatrix::Concat(a, b)); | 941 REPORTER_ASSERT(r, expected == SkMatrix::Concat(a, b)); |
| 935 } | 942 } |
| OLD | NEW |