| Index: tests/Matrix44Test.cpp |
| =================================================================== |
| --- tests/Matrix44Test.cpp (revision 1698) |
| +++ tests/Matrix44Test.cpp (working copy) |
| @@ -1,5 +1,6 @@ |
| #include "Test.h" |
| #include "SkMatrix44.h" |
| +#include "SkRect.h" |
| static bool nearly_equal_scalar(SkMScalar a, SkMScalar b) { |
| // Note that we get more compounded error for multiple operations when |
| @@ -83,6 +84,7 @@ |
| SkIntToScalar(0), |
| SkIntToScalar(-1), |
| SkIntToScalar(90)); |
| + |
| mat.postConcat(rot); |
| REPORTER_ASSERT(reporter, mat.invert(NULL)); |
| mat.invert(&inverse); |
| @@ -96,7 +98,7 @@ |
| mat.setTranslate(2, 3, 4); |
| float dataf[16]; |
| double datad[16]; |
| - |
| + |
| mat.asColMajorf(dataf); |
| assert16<float>(reporter, dataf, |
| 1, 0, 0, 0, |
| @@ -119,6 +121,19 @@ |
| 0, 0, 1, 4, |
| 0, 0, 0, 1); |
| } |
| + |
| + // Test precision of rotation in common cases |
| + int common_angles[] = { 0, 90, -90, 180, -180, 270, -270, 360, -360 }; |
| + for (int i = 0; i < 9; ++i) { |
| + rot.setRotateDegreesAbout( |
| + SkIntToScalar(0), |
| + SkIntToScalar(0), |
| + SkIntToScalar(-1), |
| + SkIntToScalar(common_angles[i])); |
| + |
| + SkMatrix rot3x3 = rot; |
| + REPORTER_ASSERT(reporter, rot3x3.rectStaysRect()); |
| + } |
| #endif |
| } |