OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |