| 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" | 8 #include "Test.h" |
| 9 #include "SkMatrix44.h" | 9 #include "SkMatrix44.h" |
| 10 | 10 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 /////////////////////////////////////////////////////////////////////////////// | 75 /////////////////////////////////////////////////////////////////////////////// |
| 76 static bool bits_isonly(int value, int mask) { | 76 static bool bits_isonly(int value, int mask) { |
| 77 return 0 == (value & ~mask); | 77 return 0 == (value & ~mask); |
| 78 } | 78 } |
| 79 | 79 |
| 80 static void test_constructor(skiatest::Reporter* reporter) { | 80 static void test_constructor(skiatest::Reporter* reporter) { |
| 81 // Allocate a matrix on the heap | 81 // Allocate a matrix on the heap |
| 82 SkMatrix44* placeholderMatrix = new SkMatrix44(); | 82 SkMatrix44* placeholderMatrix = new SkMatrix44(); |
| 83 SkAutoTDelete<SkMatrix44> deleteMe(placeholderMatrix); |
| 84 |
| 83 for (int row = 0; row < 4; ++row) { | 85 for (int row = 0; row < 4; ++row) { |
| 84 for (int col = 0; col < 4; ++col) { | 86 for (int col = 0; col < 4; ++col) { |
| 85 placeholderMatrix->setDouble(row, col, row * col); | 87 placeholderMatrix->setDouble(row, col, row * col); |
| 86 } | 88 } |
| 87 } | 89 } |
| 88 | 90 |
| 89 // Use placement-new syntax to trigger the constructor on top of the heap | 91 // Use placement-new syntax to trigger the constructor on top of the heap |
| 90 // address we already initialized. This allows us to check that the | 92 // address we already initialized. This allows us to check that the |
| 91 // constructor did avoid initializing the matrix contents. | 93 // constructor did avoid initializing the matrix contents. |
| 92 SkMatrix44* testMatrix = new(placeholderMatrix) SkMatrix44(SkMatrix44::kUnin
itialized_Constructor); | 94 SkMatrix44* testMatrix = new(placeholderMatrix) SkMatrix44(SkMatrix44::kUnin
itialized_Constructor); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 test_transpose(reporter); | 433 test_transpose(reporter); |
| 432 test_get_set_double(reporter); | 434 test_get_set_double(reporter); |
| 433 test_set_row_col_major(reporter); | 435 test_set_row_col_major(reporter); |
| 434 test_translate(reporter); | 436 test_translate(reporter); |
| 435 test_scale(reporter); | 437 test_scale(reporter); |
| 436 test_map2(reporter); | 438 test_map2(reporter); |
| 437 } | 439 } |
| 438 | 440 |
| 439 #include "TestClassDef.h" | 441 #include "TestClassDef.h" |
| 440 DEFINE_TESTCLASS("Matrix44", Matrix44TestClass, TestMatrix44) | 442 DEFINE_TESTCLASS("Matrix44", Matrix44TestClass, TestMatrix44) |
| OLD | NEW |