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 "Test.h" | |
9 #include "SkMath.h" | 8 #include "SkMath.h" |
10 #include "SkMatrix.h" | 9 #include "SkMatrix.h" |
11 #include "SkMatrixUtils.h" | 10 #include "SkMatrixUtils.h" |
12 #include "SkRandom.h" | 11 #include "SkRandom.h" |
| 12 #include "Test.h" |
13 | 13 |
14 static bool nearly_equal_scalar(SkScalar a, SkScalar b) { | 14 static bool nearly_equal_scalar(SkScalar a, SkScalar b) { |
15 const SkScalar tolerance = SK_Scalar1 / 200000; | 15 const SkScalar tolerance = SK_Scalar1 / 200000; |
16 return SkScalarAbs(a - b) <= tolerance; | 16 return SkScalarAbs(a - b) <= tolerance; |
17 } | 17 } |
18 | 18 |
19 static bool nearly_equal(const SkMatrix& a, const SkMatrix& b) { | 19 static bool nearly_equal(const SkMatrix& a, const SkMatrix& b) { |
20 for (int i = 0; i < 9; i++) { | 20 for (int i = 0; i < 9; i++) { |
21 if (!nearly_equal_scalar(a[i], b[i])) { | 21 if (!nearly_equal_scalar(a[i], b[i])) { |
22 SkDebugf("not equal %g %g\n", (float)a[i], (float)b[i]); | 22 SkDebugf("not equal %g %g\n", (float)a[i], (float)b[i]); |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 mat.set(SkMatrix::kMSkewX, SK_ScalarNaN); | 778 mat.set(SkMatrix::kMSkewX, SK_ScalarNaN); |
779 mat2.set(SkMatrix::kMSkewX, SK_ScalarNaN); | 779 mat2.set(SkMatrix::kMSkewX, SK_ScalarNaN); |
780 REPORTER_ASSERT(reporter, !are_equal(reporter, mat, mat2)); | 780 REPORTER_ASSERT(reporter, !are_equal(reporter, mat, mat2)); |
781 | 781 |
782 test_matrix_min_max_stretch(reporter); | 782 test_matrix_min_max_stretch(reporter); |
783 test_matrix_is_similarity(reporter); | 783 test_matrix_is_similarity(reporter); |
784 test_matrix_recttorect(reporter); | 784 test_matrix_recttorect(reporter); |
785 test_matrix_decomposition(reporter); | 785 test_matrix_decomposition(reporter); |
786 test_matrix_homogeneous(reporter); | 786 test_matrix_homogeneous(reporter); |
787 } | 787 } |
OLD | NEW |