| * Copyright 2016 Google Inc. |
| * Use of this source code is governed by a BSD-style license that can be |
| * found in the LICENSE file. |
| #include "src/core/SkScaleToSides.h" |
| DEF_TEST(ScaleToSides, reporter) { |
| double interestingValues[] = { |
| // From sample app - PathFuzzer |
| int numInterestingValues = (int)SK_ARRAY_COUNT(interestingValues); |
| for (int s = 0; s <= numInterestingValues; s++) { |
| for (int i = 0; i < numInterestingValues; i++) { |
| for (int j = 0; j < numInterestingValues; j++) { |
| for (int k = 0; k < numInterestingValues; k++) { |
| float radius1 = (float)interestingValues[i]; |
| float radius2 = (float)interestingValues[j]; |
| double width = interestingValues[k]; |
| double scale = sk_ieee_double_divide(width, (double)radius1 + (double)radius2); |
| scale = std::min(scale, interestingValues[s-1]); |
| if (scale < 1.0 && scale > 0.0) { |
| SkScaleToSides::AdjustRadii(width, scale, &radius1, &radius2); |