OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2016 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #include "SkScaleToSides.h" |
| 9 |
| 10 #include <cfloat> |
| 11 #include "Test.h" |
| 12 |
| 13 DEF_TEST(ScaleToSides, reporter) { |
| 14 float interestingValues[] = { |
| 15 0.0f, |
| 16 0.5f, |
| 17 1.0f, |
| 18 2.0f, |
| 19 3.0f, |
| 20 33.0f, |
| 21 33554430.0f, |
| 22 33554431.0f, |
| 23 33554464.0f, |
| 24 333333332.0f, |
| 25 333333333.0f, |
| 26 333333334.0f, |
| 27 FLT_MAX, |
| 28 FLT_EPSILON, |
| 29 FLT_MIN |
| 30 }; |
| 31 |
| 32 int numInterestingValues = (int)SK_ARRAY_COUNT(interestingValues); |
| 33 |
| 34 for (int i = 0; i < numInterestingValues; i++) { |
| 35 for (int j = 0; j < numInterestingValues; j++) { |
| 36 for (int k = 0; k < numInterestingValues; k++) { |
| 37 float radius1 = interestingValues[i]; |
| 38 float radius2 = interestingValues[j]; |
| 39 float width = interestingValues[k]; |
| 40 if (width > 0.0f) { |
| 41 double scale = (double)width / ((double)radius1 + (double)ra
dius2); |
| 42 if (scale < 1.0) { |
| 43 ScaleToSides::AdjustRadii(width, scale, &radius1, &radiu
s2); |
| 44 } |
| 45 } |
| 46 } |
| 47 } |
| 48 } |
| 49 } |
OLD | NEW |