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

Side by Side Diff: tests/MatrixTest.cpp

Issue 1135693003: Revert of Revert of stop calling SkScalarDiv (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « tests/DrawBitmapRectTest.cpp ('k') | tests/PathCoverageTest.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 * 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 "SkMath.h" 8 #include "SkMath.h"
9 #include "SkMatrix.h" 9 #include "SkMatrix.h"
10 #include "SkMatrixUtils.h" 10 #include "SkMatrixUtils.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 vectors[i].fX = rand.nextSScalar1(); 263 vectors[i].fX = rand.nextSScalar1();
264 vectors[i].fY = rand.nextSScalar1(); 264 vectors[i].fY = rand.nextSScalar1();
265 if (!vectors[i].normalize()) { 265 if (!vectors[i].normalize()) {
266 i -= 1; 266 i -= 1;
267 continue; 267 continue;
268 } 268 }
269 } 269 }
270 mat.mapVectors(vectors, SK_ARRAY_COUNT(vectors)); 270 mat.mapVectors(vectors, SK_ARRAY_COUNT(vectors));
271 for (size_t i = 0; i < SK_ARRAY_COUNT(vectors); ++i) { 271 for (size_t i = 0; i < SK_ARRAY_COUNT(vectors); ++i) {
272 SkScalar d = vectors[i].length(); 272 SkScalar d = vectors[i].length();
273 REPORTER_ASSERT(reporter, SkScalarDiv(d, maxScale) < gVectorScaleTol ); 273 REPORTER_ASSERT(reporter, d / maxScale < gVectorScaleTol);
274 REPORTER_ASSERT(reporter, SkScalarDiv(minScale, d) < gVectorScaleTol ); 274 REPORTER_ASSERT(reporter, minScale / d < gVectorScaleTol);
275 if (max < d) { 275 if (max < d) {
276 max = d; 276 max = d;
277 } 277 }
278 if (min > d) { 278 if (min > d) {
279 min = d; 279 min = d;
280 } 280 }
281 } 281 }
282 REPORTER_ASSERT(reporter, SkScalarDiv(max, maxScale) >= gCloseScaleTol); 282 REPORTER_ASSERT(reporter, max / maxScale >= gCloseScaleTol);
283 REPORTER_ASSERT(reporter, SkScalarDiv(minScale, min) >= gCloseScaleTol); 283 REPORTER_ASSERT(reporter, minScale / min >= gCloseScaleTol);
284 } 284 }
285 } 285 }
286 286
287 static void test_matrix_preserve_shape(skiatest::Reporter* reporter) { 287 static void test_matrix_preserve_shape(skiatest::Reporter* reporter) {
288 SkMatrix mat; 288 SkMatrix mat;
289 289
290 // identity 290 // identity
291 mat.setIdentity(); 291 mat.setIdentity();
292 REPORTER_ASSERT(reporter, mat.isSimilarity()); 292 REPORTER_ASSERT(reporter, mat.isSimilarity());
293 REPORTER_ASSERT(reporter, mat.preservesRightAngles()); 293 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 a.setTranslate(10, 20); 926 a.setTranslate(10, 20);
927 927
928 SkMatrix b; 928 SkMatrix b;
929 b.setScale(3, 5); 929 b.setScale(3, 5);
930 930
931 SkMatrix expected; 931 SkMatrix expected;
932 expected.setConcat(a,b); 932 expected.setConcat(a,b);
933 933
934 REPORTER_ASSERT(r, expected == SkMatrix::Concat(a, b)); 934 REPORTER_ASSERT(r, expected == SkMatrix::Concat(a, b));
935 } 935 }
OLDNEW
« no previous file with comments | « tests/DrawBitmapRectTest.cpp ('k') | tests/PathCoverageTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698