Flutter Engine
The Flutter Engine
Functions
ScaleToSidesTest.cpp File Reference
#include "include/private/base/SkFloatingPoint.h"
#include "src/core/SkScaleToSides.h"
#include "tests/Test.h"
#include <algorithm>
#include <array>
#include <cfloat>

Go to the source code of this file.

Functions

 DEF_TEST (ScaleToSides, reporter)
 

Function Documentation

◆ DEF_TEST()

DEF_TEST ( ScaleToSides  ,
reporter   
)

Definition at line 16 of file ScaleToSidesTest.cpp.

16 {
17 double interestingValues[] = {
18 // From sample app - PathFuzzer
19 260.01662826538085938,
20 63.61007690429687500,
21 795.98901367187500000,
22 217.71697616577148438,
23 686.15960693359375000,
24 556.57641601562500000,
25 // From skp bitbucket
26 111.60000228881836,
27 55.800003051757813,
28 0.99999996581812677920,
29 0.0,
30 0.5,
31 1.0,
32 2.0,
33 3.0,
34 33.0,
35 33554430.0,
36 33554431.0,
37 33554464.0,
38 333333332.0,
39 333333333.0,
40 333333334.0,
41 FLT_MAX,
42 FLT_EPSILON,
43 FLT_MIN,
44 340282569745034499980078846904281071616.0,
45 170141284872517249990039423452140535808.0,
46 170141244307698042686698575557637963776.0,
47 };
48
49 int numInterestingValues = (int)std::size(interestingValues);
50
51 for (int s = 0; s <= numInterestingValues; s++) {
52 for (int i = 0; i < numInterestingValues; i++) {
53 for (int j = 0; j < numInterestingValues; j++) {
54 for (int k = 0; k < numInterestingValues; k++) {
55 // We're about to cast values i and j to float, don't bother if they won't fit.
56 // (Is there a more robust way to test this, like SkTFitsIn but double->float?)
57 if (interestingValues[i] > FLT_MAX ||
58 interestingValues[j] > FLT_MAX) {
59 continue;
60 }
61 float radius1 = (float)interestingValues[i];
62 float radius2 = (float)interestingValues[j];
63 double width = interestingValues[k];
64 double scale = sk_ieee_double_divide(width, (double)radius1 + (double)radius2);
65 if (width > 0.0) {
66 if (s != 0) {
67 scale = std::min(scale, interestingValues[s-1]);
68 }
69 if (scale < 1.0 && scale > 0.0) {
70 SkScaleToSides::AdjustRadii(width, scale, &radius1, &radius2);
71 }
72 }
73 }
74 }
75 }
76 }
77}
static constexpr double sk_ieee_double_divide(double numer, double denom)
static void AdjustRadii(double limit, double scale, SkScalar *a, SkScalar *b)
struct MyStruct s
static float min(float r, float g, float b)
Definition: hsl.cpp:48
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
int32_t width
const Scalar scale