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

Side by Side Diff: tests/ScaleToSidesTest.cpp

Issue 1569403002: Fix radii calculation (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update comment. Created 4 years, 11 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/DrawPathTest.cpp ('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
(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 }
OLDNEW
« no previous file with comments | « tests/DrawPathTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698