diff options
author | 2016-06-23 12:42:29 -0700 | |
---|---|---|
committer | 2016-06-23 12:42:29 -0700 | |
commit | c1a3e24918f99fc0b975111afb39dca38c50eb5c (patch) | |
tree | 8bfaaff83d9fac23c532f2a1dcff1ed804b8453d /tests/Matrix44Test.cpp | |
parent | ac5fcea9c3ec32a87bfd8cb96531e82097a1d861 (diff) |
SkMatrix44 clarifications and clean-ups
Fixed row/col major bug and added comments to the
header.
Made SkMatrix::I() thread safe using constexpr.
Added a test set3x3RowMajorf().
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2098583002
Review-Url: https://codereview.chromium.org/2098583002
Diffstat (limited to 'tests/Matrix44Test.cpp')
-rw-r--r-- | tests/Matrix44Test.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/Matrix44Test.cpp b/tests/Matrix44Test.cpp index f4b6783c36..75086b68ae 100644 --- a/tests/Matrix44Test.cpp +++ b/tests/Matrix44Test.cpp @@ -484,6 +484,23 @@ static void test_get_set_double(skiatest::Reporter* reporter) { } } +static void test_set_3x3(skiatest::Reporter* r) { + static float vals[9] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, }; + + SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor); + mat.set3x3RowMajorf(vals); + + REPORTER_ASSERT(r, 1.0f == mat.getFloat(0, 0)); + REPORTER_ASSERT(r, 2.0f == mat.getFloat(0, 1)); + REPORTER_ASSERT(r, 3.0f == mat.getFloat(0, 2)); + REPORTER_ASSERT(r, 4.0f == mat.getFloat(1, 0)); + REPORTER_ASSERT(r, 5.0f == mat.getFloat(1, 1)); + REPORTER_ASSERT(r, 6.0f == mat.getFloat(1, 2)); + REPORTER_ASSERT(r, 7.0f == mat.getFloat(2, 0)); + REPORTER_ASSERT(r, 8.0f == mat.getFloat(2, 1)); + REPORTER_ASSERT(r, 9.0f == mat.getFloat(2, 2)); +} + static void test_set_row_col_major(skiatest::Reporter* reporter) { SkMatrix44 a(SkMatrix44::kUninitialized_Constructor); SkMatrix44 b(SkMatrix44::kUninitialized_Constructor); @@ -916,6 +933,7 @@ DEF_TEST(Matrix44, reporter) { test_transpose(reporter); test_get_set_double(reporter); test_set_row_col_major(reporter); + test_set_3x3(reporter); test_translate(reporter); test_scale(reporter); test_map2(reporter); |