28 {{{{1, 1}, {2, 1}, {0, 2}}}, {{{0, 0}, {1, 1}}}, 1, {{1, 1}, {0, 0}} },
29 {{{{0, 0}, {1, 1}, {3, 1}}}, {{{0, 0}, {3, 1}}}, 2, {{0, 0}, {3, 1}} },
30 {{{{2, 0}, {1, 1}, {2, 2}}}, {{{0, 0}, {0, 2}}}, 0, {{0, 0}, {0, 0}} },
31 {{{{4, 0}, {0, 1}, {4, 2}}}, {{{3, 1}, {4, 1}}}, 0, {{0, 0}, {0, 0}} },
32 {{{{0, 0}, {0, 1}, {1, 1}}}, {{{0, 1}, {1, 0}}}, 1, {{.25, .75}, {0, 0}} },
41 if (line[0].fX == line[1].fX) {
42 double top = line[0].fY;
43 double bottom = line[1].fY;
44 flipped = top > bottom;
49 result = intersections.
vertical(quad, top, bottom, line[0].fX, flipped);
50 }
else if (line[0].fY == line[1].fY) {
51 double left = line[0].fX;
52 double right = line[1].fX;
70 {{{{97.9337616,100}, {88,112.94265}, {88,130}}},
71 {{{88.919838,120}, {107.058823,120}}}},
72 {{{{447.96701049804687, 894.4381103515625}, {448.007080078125, 894.4239501953125},
73 {448.0140380859375, 894.4215087890625}}},
74 {{{490.43548583984375, 879.40740966796875}, {405.59262084960937, 909.435546875}}}},
75 {{{{142.589081, 102.283646}, {149.821579, 100}, {158, 100}}},
76 {{{90, 230}, {160, 60}}}},
77 {{{{1101, 10}, {1101, 8.3431453704833984}, {1099.828857421875, 7.1711997985839844}}},
78 {{{1099.828857421875,7.1711711883544922}, {1099.121337890625,7.8786783218383789}}}},
79 {{{{973, 507}, {973, 508.24264526367187}, {972.12158203125, 509.12161254882812}}},
80 {{{930, 467}, {973, 510}}}},
81 {{{{369.848602, 145.680267}, {382.360413, 121.298294}, {406.207703, 121.298294}}},
82 {{{406.207703, 121.298294}, {348.781738, 123.864815}}}},
98 for (
int inner = 0; inner <
result; ++inner) {
99 double quadT = intersections[0][inner];
101 double lineT = intersections[1][inner];
102 SkDPoint lineXY = line.ptAtT(lineT);
117 int iIndex =
static_cast<int>(index);
125 int order1 = reducer1.
reduce(quad);
126 int order2 = reducer2.
reduce(line);
128 SkDebugf(
"%s [%d] quad order=%d\n", __FUNCTION__, iIndex, order1);
132 SkDebugf(
"%s [%d] line order=%d\n", __FUNCTION__, iIndex, order2);
136 bool flipped =
false;
139 if (intersections.
used() <= 0) {
142 for (
int pt = 0; pt <
result; ++pt) {
143 double tt1 = intersections[0][pt];
146 double tt2 = intersections[1][pt];
150 SkDebugf(
"%s [%d,%d] x!= t1=%1.9g (%1.9g,%1.9g) t2=%1.9g (%1.9g,%1.9g)\n",
151 __FUNCTION__, iIndex, pt, tt1, t1.
fX, t1.
fY, tt2, t2.
fX, t2.
fY);
157 SkDebugf(
"%s t1=(%1.9g,%1.9g)\n", __FUNCTION__, t1.
fX, t1.
fY);
static void testOneOffs(skiatest::Reporter *reporter)
static struct oneLineQuad oneOffs[]
static struct lineQuad lineQuadTests[]
static int doIntersect(SkIntersections &intersections, const SkDQuad &quad, const SkDLine &line, bool &flipped)
static size_t lineQuadTests_count
static size_t oneOffs_count
bool ValidLine(const SkDLine &line)
bool ValidQuad(const SkDQuad &quad)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
void swap(sk_sp< T > &a, sk_sp< T > &b)
#define DEF_TEST(name, reporter)
#define REPORTER_ASSERT(r, cond,...)
int intersect(const SkDLine &, const SkDLine &)
int vertical(const SkDLine &, double top, double bottom, double x, bool flipped)
int horizontal(const SkDLine &, double left, double right, double y, bool flipped)
SkDPoint fPts[kPointCount]
bool approximatelyEqual(const SkDPoint &a) const
void debugSet(const SkDPoint *pts)
SkDPoint ptAtT(double t) const
int reduce(const SkDCubic &cubic, Quadratics)