27 {{{{-164.3726806640625, 36.826904296875}, {-189.045166015625, -953.2220458984375},
28 {926.505859375, -897.36175537109375}, {-139.33489990234375, 204.40771484375}}},
29 0.37329583, {107.54935269006289, -632.13736293162208}},
30 {{{{784.056884765625, -554.8350830078125}, {67.5489501953125, 509.0224609375},
31 {-447.713134765625, 751.375}, {415.7784423828125, 172.22265625}}},
32 0.660005242, {-32.973148967736151, 478.01341797403569}},
33 {{{{-580.6834716796875, -127.044921875}, {-872.8983154296875, -945.54302978515625},
34 {260.8092041015625, -909.34991455078125}, {-976.2125244140625, -18.46551513671875}}},
35 0.578826774, {-390.17910153915489, -687.21144412296007}},
41 9.15910731e-007, 8.6600277e-007, 7.4122059e-007, 6.92087618e-007, 8.35290245e-007,
42 3.29763199e-007, 5.07547773e-007, 4.41294224e-007, 0, 0,
43 3.76879167e-006, 1.06126249e-006, 2.36873967e-006, 1.62421134e-005, 3.09103599e-005,
44 4.38917976e-005, 0.000112348938, 0.000243149242, 0.000433174114, 0.00170880232,
45 0.00272619724, 0.00518844604, 0.000352621078, 0.00175960064, 0.027875185,
46 0.0351329803, 0.103964925,
60 double firstStep =
step;
67 double calcX = cubicAtT.
fX - pt.
fX;
68 double calcY = cubicAtT.
fY - pt.
fY;
69 double calcDist = calcX * calcX + calcY * calcY;
71 SkDebugf(
"binary search failed: step=%1.9g cubic=", firstStep);
78 double lastStep =
step;
81 double lessX = lessPt.
fX - pt.
fX;
82 double lessY = lessPt.
fY - pt.
fY;
83 double lessDist = lessX * lessX + lessY * lessY;
85 if (calcDist > lessDist) {
90 double moreX = morePt.
fX - pt.
fX;
91 double moreY = morePt.
fY - pt.
fY;
92 double moreDist = moreX * moreX + moreY * moreY;
93 if (calcDist <= moreDist) {
104static bool r2check(
double A,
double B,
double C,
double D,
double* R2MinusQ3Ptr) {
127 double Q = (a2 -
b * 3) / 9;
128 double R = (2 * a2 *
a - 9 *
a *
b + 27 * c) / 54;
130 double Q3 =
Q *
Q *
Q;
131 double R2MinusQ3 =
R2 -
Q3;
132 *R2MinusQ3Ptr = R2MinusQ3;
145 double worstStep[256] = {0};
148 double smallestR2 = 0;
149 double largestR2 = 0;
150 for (
int index = 0; index < 1000000000; ++index) {
167 double allRoots[3] = {0}, validRoots[3] = {0};
173 if (realRoots == 1) {
183 if (r2check(
A,
B,
C,
D, &R2MinusQ3)) {
184 smallestR2 =
std::min(smallestR2, R2MinusQ3);
185 largestR2 =
std::max(largestR2, R2MinusQ3);
188 double largest =
std::max(fabs(allRoots[0]), fabs(allRoots[1]));
189 if (realRoots == 3) {
190 largest =
std::max(largest, fabs(allRoots[2]));
195 SkDebugf(
"realRoots=%d (%1.9g, %1.9g, %1.9g) valid=%d (%1.9g, %1.9g, %1.9g)\n",
196 realRoots, allRoots[0], allRoots[1], allRoots[2], valid, validRoots[0],
197 validRoots[1], validRoots[2]);
199 double smallest =
std::min(allRoots[0], allRoots[1]);
200 if (realRoots == 3) {
201 smallest =
std::min(smallest, allRoots[2]);
207 frexp(largest, &largeBits);
212 if (largeBits > 21) {
214 }
else if (largeBits > 18) {
216 }
else if (largeBits > 15) {
218 }
else if (largeBits > 12) {
220 }
else if (largeBits > 9) {
227 diff = fabs(t - newT);
233 worstStep[largeBits] =
std::max(worstStep[largeBits], diff);
248 while (worstStep[--worstLimit] == 0) ;
249 for (
int idx2 = 0; idx2 <= worstLimit; ++idx2) {
250 SkDebugf(
"%1.9g ", worstStep[idx2]);
253 SkDebugf(
"smallestR2=%1.9g largestR2=%1.9g\n", smallestR2, largestR2);
264 double allRoots[3] = {0}, validRoots[3] = {0};
269 double t = validRoots[0];
static int step(int x, SkScalar min, SkScalar max)
static double testOneFailure(const CubicLineFailures &failure)
static struct CubicLineFailures cubicLineFailures[]
int cubicLineFailuresCount
DEF_TEST(PathOpsCubicLineRoots, reporter)
static bool gPathOpsCubicLineIntersectionIdeasVerbose
static double binary_search(const SkDCubic &cubic, double step, const SkDPoint &pt, double t, int *iters)
#define SkASSERT_RELEASE(cond)
static bool approximately_zero(double x)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
bool approximately_zero_when_compared_to(double x, double y)
float nextRangeF(float min, float max)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
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
SkDPoint fPts[kPointCount]
static int RootsReal(double A, double B, double C, double D, double t[3])
static void Coefficients(const double *cubic, double *A, double *B, double *C, double *D)
bool approximatelyEqual(const SkDPoint &a) const
static int AddValidTs(double s[], int realRoots, double *t)