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

Side by Side Diff: tests/MatrixTest.cpp

Issue 494113002: Temporarily adjust Matrix.isSimilarity test tolerance on 64-bit ARM devices (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 | « gyp/common_conditions.gypi ('k') | no next file » | 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 313
314 // perspective y 314 // perspective y
315 mat.reset(); 315 mat.reset();
316 mat.setPerspY(SkScalarToPersp(SK_Scalar1 / 2)); 316 mat.setPerspY(SkScalarToPersp(SK_Scalar1 / 2));
317 REPORTER_ASSERT(reporter, !mat.isSimilarity()); 317 REPORTER_ASSERT(reporter, !mat.isSimilarity());
318 318
319 // rotate 319 // rotate
320 for (int angle = 0; angle < 360; ++angle) { 320 for (int angle = 0; angle < 360; ++angle) {
321 mat.reset(); 321 mat.reset();
322 mat.setRotate(SkIntToScalar(angle)); 322 mat.setRotate(SkIntToScalar(angle));
323 #ifndef SK_CPU_ARM64
323 REPORTER_ASSERT(reporter, mat.isSimilarity()); 324 REPORTER_ASSERT(reporter, mat.isSimilarity());
325 #else
326 // 64-bit ARM devices built with -O2 and -ffp-contract=fast have a loss
327 // of precision and require that we have a higher tolerance
328 REPORTER_ASSERT(reporter, mat.isSimilarity(SK_ScalarNearlyZero + 0.00010 113f));
329 #endif
324 } 330 }
325 331
326 // see if there are any accumulated precision issues 332 // see if there are any accumulated precision issues
327 mat.reset(); 333 mat.reset();
328 for (int i = 1; i < 360; i++) { 334 for (int i = 1; i < 360; i++) {
329 mat.postRotate(SkIntToScalar(1)); 335 mat.postRotate(SkIntToScalar(1));
330 } 336 }
331 REPORTER_ASSERT(reporter, mat.isSimilarity()); 337 REPORTER_ASSERT(reporter, mat.isSimilarity());
332 338
333 // rotate + translate 339 // rotate + translate
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 a.setTranslate(10, 20); 826 a.setTranslate(10, 20);
821 827
822 SkMatrix b; 828 SkMatrix b;
823 b.setScale(3, 5); 829 b.setScale(3, 5);
824 830
825 SkMatrix expected; 831 SkMatrix expected;
826 expected.setConcat(a,b); 832 expected.setConcat(a,b);
827 833
828 REPORTER_ASSERT(r, expected == SkMatrix::Concat(a, b)); 834 REPORTER_ASSERT(r, expected == SkMatrix::Concat(a, b));
829 } 835 }
OLDNEW
« no previous file with comments | « gyp/common_conditions.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698