| 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 "SkMatrix44.h" | 8 #include "SkMatrix44.h" |
| 9 #include "Test.h" | 9 #include "Test.h" |
| 10 | 10 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 REPORTER_ASSERT(reporter, nearly_equal_double(row * col, testMatrix-
>getDouble(row, col))); | 97 REPORTER_ASSERT(reporter, nearly_equal_double(row * col, testMatrix-
>getDouble(row, col))); |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 // Verify that kIdentity_Constructor really does initialize to an identity m
atrix. | 101 // Verify that kIdentity_Constructor really does initialize to an identity m
atrix. |
| 102 testMatrix = 0; | 102 testMatrix = 0; |
| 103 testMatrix = new(placeholderMatrix) SkMatrix44(SkMatrix44::kIdentity_Constru
ctor); | 103 testMatrix = new(placeholderMatrix) SkMatrix44(SkMatrix44::kIdentity_Constru
ctor); |
| 104 REPORTER_ASSERT(reporter, testMatrix == placeholderMatrix); | 104 REPORTER_ASSERT(reporter, testMatrix == placeholderMatrix); |
| 105 REPORTER_ASSERT(reporter, testMatrix->isIdentity()); | 105 REPORTER_ASSERT(reporter, testMatrix->isIdentity()); |
| 106 REPORTER_ASSERT(reporter, *testMatrix == SkMatrix44::I()); | 106 REPORTER_ASSERT(reporter, *testMatrix == SkMatrix44::I()); |
| 107 |
| 108 // Verify that that constructing from an SkMatrix initializes everything. |
| 109 SkMatrix44 scaleMatrix(SkMatrix44::kUninitialized_Constructor); |
| 110 scaleMatrix.setScale(3, 4, 5); |
| 111 REPORTER_ASSERT(reporter, scaleMatrix.isScale()); |
| 112 testMatrix = new(&scaleMatrix) SkMatrix44(SkMatrix::I()); |
| 113 REPORTER_ASSERT(reporter, testMatrix->isIdentity()); |
| 114 REPORTER_ASSERT(reporter, *testMatrix == SkMatrix44::I()); |
| 107 } | 115 } |
| 108 | 116 |
| 109 static void test_translate(skiatest::Reporter* reporter) { | 117 static void test_translate(skiatest::Reporter* reporter) { |
| 110 SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor); | 118 SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor); |
| 111 SkMatrix44 inverse(SkMatrix44::kUninitialized_Constructor); | 119 SkMatrix44 inverse(SkMatrix44::kUninitialized_Constructor); |
| 112 | 120 |
| 113 mat.setTranslate(0, 0, 0); | 121 mat.setTranslate(0, 0, 0); |
| 114 REPORTER_ASSERT(reporter, bits_isonly(mat.getType(), SkMatrix44::kIdentity_M
ask)); | 122 REPORTER_ASSERT(reporter, bits_isonly(mat.getType(), SkMatrix44::kIdentity_M
ask)); |
| 115 mat.setTranslate(1, 2, 3); | 123 mat.setTranslate(1, 2, 3); |
| 116 REPORTER_ASSERT(reporter, bits_isonly(mat.getType(), SkMatrix44::kTranslate_
Mask)); | 124 REPORTER_ASSERT(reporter, bits_isonly(mat.getType(), SkMatrix44::kTranslate_
Mask)); |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 test_get_set_double(reporter); | 887 test_get_set_double(reporter); |
| 880 test_set_row_col_major(reporter); | 888 test_set_row_col_major(reporter); |
| 881 test_translate(reporter); | 889 test_translate(reporter); |
| 882 test_scale(reporter); | 890 test_scale(reporter); |
| 883 test_map2(reporter); | 891 test_map2(reporter); |
| 884 test_3x3_conversion(reporter); | 892 test_3x3_conversion(reporter); |
| 885 test_has_perspective(reporter); | 893 test_has_perspective(reporter); |
| 886 test_preserves_2d_axis_alignment(reporter); | 894 test_preserves_2d_axis_alignment(reporter); |
| 887 test_toint(reporter); | 895 test_toint(reporter); |
| 888 } | 896 } |
| OLD | NEW |