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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 REPORTER_ASSERT(reporter, buffer[6] == g); | 86 REPORTER_ASSERT(reporter, buffer[6] == g); |
87 REPORTER_ASSERT(reporter, buffer[7] == h); | 87 REPORTER_ASSERT(reporter, buffer[7] == h); |
88 REPORTER_ASSERT(reporter, buffer[8] == i); | 88 REPORTER_ASSERT(reporter, buffer[8] == i); |
89 } | 89 } |
90 | 90 |
91 static void test_set9(skiatest::Reporter* reporter) { | 91 static void test_set9(skiatest::Reporter* reporter) { |
92 | 92 |
93 SkMatrix m; | 93 SkMatrix m; |
94 m.reset(); | 94 m.reset(); |
95 assert9(reporter, m, 1, 0, 0, 0, 1, 0, 0, 0, 1); | 95 assert9(reporter, m, 1, 0, 0, 0, 1, 0, 0, 0, 1); |
96 | 96 |
97 m.setScale(2, 3); | 97 m.setScale(2, 3); |
98 assert9(reporter, m, 2, 0, 0, 0, 3, 0, 0, 0, 1); | 98 assert9(reporter, m, 2, 0, 0, 0, 3, 0, 0, 0, 1); |
99 | 99 |
100 m.postTranslate(4, 5); | 100 m.postTranslate(4, 5); |
101 assert9(reporter, m, 2, 0, 4, 0, 3, 5, 0, 0, 1); | 101 assert9(reporter, m, 2, 0, 4, 0, 3, 5, 0, 0, 1); |
102 | 102 |
103 SkScalar buffer[9]; | 103 SkScalar buffer[9]; |
104 sk_bzero(buffer, sizeof(buffer)); | 104 sk_bzero(buffer, sizeof(buffer)); |
105 buffer[SkMatrix::kMScaleX] = 1; | 105 buffer[SkMatrix::kMScaleX] = 1; |
106 buffer[SkMatrix::kMScaleY] = 1; | 106 buffer[SkMatrix::kMScaleY] = 1; |
107 buffer[SkMatrix::kMPersp2] = 1; | 107 buffer[SkMatrix::kMPersp2] = 1; |
108 REPORTER_ASSERT(reporter, !m.isIdentity()); | 108 REPORTER_ASSERT(reporter, !m.isIdentity()); |
109 m.set9(buffer); | 109 m.set9(buffer); |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 a.setTranslate(10, 20); | 946 a.setTranslate(10, 20); |
947 | 947 |
948 SkMatrix b; | 948 SkMatrix b; |
949 b.setScale(3, 5); | 949 b.setScale(3, 5); |
950 | 950 |
951 SkMatrix expected; | 951 SkMatrix expected; |
952 expected.setConcat(a,b); | 952 expected.setConcat(a,b); |
953 | 953 |
954 REPORTER_ASSERT(r, expected == SkMatrix::Concat(a, b)); | 954 REPORTER_ASSERT(r, expected == SkMatrix::Concat(a, b)); |
955 } | 955 } |
OLD | NEW |