Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1466)

Side by Side Diff: tests/MatrixTest.cpp

Issue 27044002: Clean up SkTypes.h. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: For patch -p1. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/Matrix44Test.cpp ('k') | tests/PathOpsQuadReduceOrderTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "Test.h" 8 #include "Test.h"
9 #include "SkMath.h" 9 #include "SkMath.h"
10 #include "SkMatrix.h" 10 #include "SkMatrix.h"
11 #include "SkMatrixUtils.h" 11 #include "SkMatrixUtils.h"
12 #include "SkRandom.h" 12 #include "SkRandom.h"
13 13
14 static bool nearly_equal_scalar(SkScalar a, SkScalar b) { 14 static bool nearly_equal_scalar(SkScalar a, SkScalar b) {
15 // Note that we get more compounded error for multiple operations when 15 // Note that we get more compounded error for multiple operations when
16 // SK_SCALAR_IS_FIXED. 16 // SK_SCALAR_IS_FIXED.
17 #ifdef SK_SCALAR_IS_FLOAT 17 #ifdef SK_SCALAR_IS_FLOAT
18 const SkScalar tolerance = SK_Scalar1 / 200000; 18 const SkScalar tolerance = SK_Scalar1 / 200000;
19 #else 19 #else
20 const SkScalar tolerance = SK_Scalar1 / 1024; 20 const SkScalar tolerance = SK_Scalar1 / 1024;
21 #endif 21 #endif
22 22
23 return SkScalarAbs(a - b) <= tolerance; 23 return SkScalarAbs(a - b) <= tolerance;
24 } 24 }
25 25
26 static bool nearly_equal(const SkMatrix& a, const SkMatrix& b) { 26 static bool nearly_equal(const SkMatrix& a, const SkMatrix& b) {
27 for (int i = 0; i < 9; i++) { 27 for (int i = 0; i < 9; i++) {
28 if (!nearly_equal_scalar(a[i], b[i])) { 28 if (!nearly_equal_scalar(a[i], b[i])) {
29 printf("not equal %g %g\n", (float)a[i], (float)b[i]); 29 SkDebugf("not equal %g %g\n", (float)a[i], (float)b[i]);
30 return false; 30 return false;
31 } 31 }
32 } 32 }
33 return true; 33 return true;
34 } 34 }
35 35
36 static bool are_equal(skiatest::Reporter* reporter, 36 static bool are_equal(skiatest::Reporter* reporter,
37 const SkMatrix& a, 37 const SkMatrix& a,
38 const SkMatrix& b) { 38 const SkMatrix& b) {
39 bool equal = a == b; 39 bool equal = a == b;
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 798
799 test_matrix_max_stretch(reporter); 799 test_matrix_max_stretch(reporter);
800 test_matrix_is_similarity(reporter); 800 test_matrix_is_similarity(reporter);
801 test_matrix_recttorect(reporter); 801 test_matrix_recttorect(reporter);
802 test_matrix_decomposition(reporter); 802 test_matrix_decomposition(reporter);
803 test_matrix_homogeneous(reporter); 803 test_matrix_homogeneous(reporter);
804 } 804 }
805 805
806 #include "TestClassDef.h" 806 #include "TestClassDef.h"
807 DEFINE_TESTCLASS("Matrix", MatrixTestClass, TestMatrix) 807 DEFINE_TESTCLASS("Matrix", MatrixTestClass, TestMatrix)
OLDNEW
« no previous file with comments | « tests/Matrix44Test.cpp ('k') | tests/PathOpsQuadReduceOrderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698