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 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 REPORTER_ASSERT(reporter, !are_equal(reporter, mat, mat2)); | 932 REPORTER_ASSERT(reporter, !are_equal(reporter, mat, mat2)); |
933 | 933 |
934 test_matrix_min_max_scale(reporter); | 934 test_matrix_min_max_scale(reporter); |
935 test_matrix_preserve_shape(reporter); | 935 test_matrix_preserve_shape(reporter); |
936 test_matrix_recttorect(reporter); | 936 test_matrix_recttorect(reporter); |
937 test_matrix_decomposition(reporter); | 937 test_matrix_decomposition(reporter); |
938 test_matrix_homogeneous(reporter); | 938 test_matrix_homogeneous(reporter); |
939 test_set9(reporter); | 939 test_set9(reporter); |
940 | 940 |
941 test_decompScale(reporter); | 941 test_decompScale(reporter); |
| 942 |
| 943 mat.setScaleTranslate(2, 3, 1, 4); |
| 944 mat2.setScale(2, 3); |
| 945 mat2.postTranslate(1, 4); |
| 946 REPORTER_ASSERT(reporter, mat == mat2); |
942 } | 947 } |
943 | 948 |
944 DEF_TEST(Matrix_Concat, r) { | 949 DEF_TEST(Matrix_Concat, r) { |
945 SkMatrix a; | 950 SkMatrix a; |
946 a.setTranslate(10, 20); | 951 a.setTranslate(10, 20); |
947 | 952 |
948 SkMatrix b; | 953 SkMatrix b; |
949 b.setScale(3, 5); | 954 b.setScale(3, 5); |
950 | 955 |
951 SkMatrix expected; | 956 SkMatrix expected; |
(...skipping 20 matching lines...) Expand all Loading... |
972 | 977 |
973 mat.mapPoints((SkPoint*)&dst[0].fLeft, (SkPoint*)&src.fLeft, 2); | 978 mat.mapPoints((SkPoint*)&dst[0].fLeft, (SkPoint*)&src.fLeft, 2); |
974 dst[0].sort(); | 979 dst[0].sort(); |
975 mat.mapRect(&dst[1], src); | 980 mat.mapRect(&dst[1], src); |
976 mat.mapRectScaleTranslate(&dst[2], src); | 981 mat.mapRectScaleTranslate(&dst[2], src); |
977 | 982 |
978 REPORTER_ASSERT(r, dst[0] == dst[1]); | 983 REPORTER_ASSERT(r, dst[0] == dst[1]); |
979 REPORTER_ASSERT(r, dst[0] == dst[2]); | 984 REPORTER_ASSERT(r, dst[0] == dst[2]); |
980 } | 985 } |
981 } | 986 } |
OLD | NEW |