Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
SkIntersections Class Reference

#include <SkIntersections.h>

Classes

class  TArray
 

Public Types

enum  DebugLoop { kIterations_DebugLoop , kCoinCheck_DebugLoop , kComputePerp_DebugLoop }
 

Public Member Functions

 SkIntersections (SkDEBUGCODE(SkOpGlobalState *globalState=nullptr))
 
TArray operator[] (int n) const
 
void allowNear (bool nearAllowed)
 
void clearCoincidence (int index)
 
int conicHorizontal (const SkPoint a[3], SkScalar weight, SkScalar left, SkScalar right, SkScalar y, bool flipped)
 
int conicVertical (const SkPoint a[3], SkScalar weight, SkScalar top, SkScalar bottom, SkScalar x, bool flipped)
 
int conicLine (const SkPoint a[3], SkScalar weight, const SkPoint b[2])
 
int cubicHorizontal (const SkPoint a[4], SkScalar left, SkScalar right, SkScalar y, bool flipped)
 
int cubicVertical (const SkPoint a[4], SkScalar top, SkScalar bottom, SkScalar x, bool flipped)
 
int cubicLine (const SkPoint a[4], const SkPoint b[2])
 
bool hasT (double t) const
 
bool hasOppT (double t) const
 
int insertSwap (double one, double two, const SkDPoint &pt)
 
bool isCoincident (int index)
 
int lineHorizontal (const SkPoint a[2], SkScalar left, SkScalar right, SkScalar y, bool flipped)
 
int lineVertical (const SkPoint a[2], SkScalar top, SkScalar bottom, SkScalar x, bool flipped)
 
int lineLine (const SkPoint a[2], const SkPoint b[2])
 
bool nearlySame (int index) const
 
const SkDPointpt (int index) const
 
const SkDPointpt2 (int index) const
 
int quadHorizontal (const SkPoint a[3], SkScalar left, SkScalar right, SkScalar y, bool flipped)
 
int quadVertical (const SkPoint a[3], SkScalar top, SkScalar bottom, SkScalar x, bool flipped)
 
int quadLine (const SkPoint a[3], const SkPoint b[2])
 
void reset ()
 
void set (bool swap, int tIndex, double t)
 
void setMax (int max)
 
void swap ()
 
bool swapped () const
 
int used () const
 
void downDepth ()
 
bool unBumpT (int index)
 
void upDepth ()
 
void alignQuadPts (const SkPoint a[3], const SkPoint b[3])
 
int cleanUpCoincidence ()
 
int closestTo (double rangeStart, double rangeEnd, const SkDPoint &testPt, double *dist) const
 
void cubicInsert (double one, double two, const SkDPoint &pt, const SkDCubic &c1, const SkDCubic &c2)
 
void flip ()
 
int horizontal (const SkDLine &, double left, double right, double y, bool flipped)
 
int horizontal (const SkDQuad &, double left, double right, double y, bool flipped)
 
int horizontal (const SkDQuad &, double left, double right, double y, double tRange[2])
 
int horizontal (const SkDCubic &, double y, double tRange[3])
 
int horizontal (const SkDConic &, double left, double right, double y, bool flipped)
 
int horizontal (const SkDCubic &, double left, double right, double y, bool flipped)
 
int horizontal (const SkDCubic &, double left, double right, double y, double tRange[3])
 
int insert (double one, double two, const SkDPoint &pt)
 
void insertNear (double one, double two, const SkDPoint &pt1, const SkDPoint &pt2)
 
int insertCoincident (double one, double two, const SkDPoint &pt)
 
int intersect (const SkDLine &, const SkDLine &)
 
int intersect (const SkDQuad &, const SkDLine &)
 
int intersect (const SkDQuad &, const SkDQuad &)
 
int intersect (const SkDConic &, const SkDLine &)
 
int intersect (const SkDConic &, const SkDQuad &)
 
int intersect (const SkDConic &, const SkDConic &)
 
int intersect (const SkDCubic &, const SkDLine &)
 
int intersect (const SkDCubic &, const SkDQuad &)
 
int intersect (const SkDCubic &, const SkDConic &)
 
int intersect (const SkDCubic &, const SkDCubic &)
 
int intersectRay (const SkDLine &, const SkDLine &)
 
int intersectRay (const SkDQuad &, const SkDLine &)
 
int intersectRay (const SkDConic &, const SkDLine &)
 
int intersectRay (const SkDCubic &, const SkDLine &)
 
int intersectRay (const SkTCurve &tCurve, const SkDLine &line)
 
void merge (const SkIntersections &, int, const SkIntersections &, int)
 
int mostOutside (double rangeStart, double rangeEnd, const SkDPoint &origin) const
 
void removeOne (int index)
 
void setCoincident (int index)
 
int vertical (const SkDLine &, double top, double bottom, double x, bool flipped)
 
int vertical (const SkDQuad &, double top, double bottom, double x, bool flipped)
 
int vertical (const SkDConic &, double top, double bottom, double x, bool flipped)
 
int vertical (const SkDCubic &, double top, double bottom, double x, bool flipped)
 
int depth () const
 
void debugBumpLoopCount (DebugLoop)
 
int debugCoincidentUsed () const
 
int debugLoopCount (DebugLoop) const
 
void debugResetLoopCount ()
 
void dump () const
 

Static Public Member Functions

static double HorizontalIntercept (const SkDLine &line, double y)
 
static int HorizontalIntercept (const SkDQuad &quad, SkScalar y, double *roots)
 
static int HorizontalIntercept (const SkDConic &conic, SkScalar y, double *roots)
 
static double VerticalIntercept (const SkDLine &line, double x)
 
static int VerticalIntercept (const SkDQuad &quad, SkScalar x, double *roots)
 
static int VerticalIntercept (const SkDConic &conic, SkScalar x, double *roots)
 

Detailed Description

Definition at line 29 of file SkIntersections.h.

Member Enumeration Documentation

◆ DebugLoop

Enumerator
kIterations_DebugLoop 
kCoinCheck_DebugLoop 
kComputePerp_DebugLoop 

Definition at line 309 of file SkIntersections.h.

Constructor & Destructor Documentation

◆ SkIntersections()

SkIntersections::SkIntersections ( SkDEBUGCODE(SkOpGlobalState *globalState=nullptr)  )
inline

Definition at line 31 of file SkIntersections.h.

32 : fSwap(0)
33#ifdef SK_DEBUG
34 SkDEBUGPARAMS(fDebugGlobalState(globalState))
35 , fDepth(0)
36#endif
37 {
38 sk_bzero(fPt, sizeof(fPt));
39 sk_bzero(fPt2, sizeof(fPt2));
40 sk_bzero(fT, sizeof(fT));
41 sk_bzero(fNearlySame, sizeof(fNearlySame));
42#if DEBUG_T_SECT_LOOP_COUNT
43 sk_bzero(fDebugLoopCount, sizeof(fDebugLoopCount));
44#endif
45 reset();
46 fMax = 0; // require that the caller set the max
47 }
static void sk_bzero(void *buffer, size_t size)
Definition SkMalloc.h:105
#define SkDEBUGPARAMS(...)

Member Function Documentation

◆ alignQuadPts()

void SkIntersections::alignQuadPts ( const SkPoint  a[3],
const SkPoint  b[3] 
)

◆ allowNear()

void SkIntersections::allowNear ( bool  nearAllowed)
inline

Definition at line 59 of file SkIntersections.h.

59 {
60 fAllowNear = nearAllowed;
61 }

◆ cleanUpCoincidence()

int SkIntersections::cleanUpCoincidence ( )

◆ clearCoincidence()

void SkIntersections::clearCoincidence ( int  index)
inline

Definition at line 63 of file SkIntersections.h.

63 {
64 SkASSERT(index >= 0);
65 int bit = 1 << index;
66 fIsCoincident[0] &= ~bit;
67 fIsCoincident[1] &= ~bit;
68 }
#define SkASSERT(cond)
Definition SkAssert.h:116

◆ closestTo()

int SkIntersections::closestTo ( double  rangeStart,
double  rangeEnd,
const SkDPoint testPt,
double *  dist 
) const

Definition at line 12 of file SkIntersections.cpp.

13 {
14 int closest = -1;
15 *closestDist = SK_ScalarMax;
16 for (int index = 0; index < fUsed; ++index) {
17 if (!between(rangeStart, fT[0][index], rangeEnd)) {
18 continue;
19 }
20 const SkDPoint& iPt = fPt[index];
21 double dist = testPt.distanceSquared(iPt);
22 if (*closestDist > dist) {
23 *closestDist = dist;
24 closest = index;
25 }
26 }
27 return closest;
28}
static bool between(SkScalar a, SkScalar b, SkScalar c)
#define SK_ScalarMax
Definition SkScalar.h:24
double distanceSquared(const SkDPoint &a) const

◆ conicHorizontal()

int SkIntersections::conicHorizontal ( const SkPoint  a[3],
SkScalar  weight,
SkScalar  left,
SkScalar  right,
SkScalar  y,
bool  flipped 
)
inline

Definition at line 70 of file SkIntersections.h.

71 {
73 conic.set(a, weight);
74 fMax = 2;
75 return horizontal(conic, left, right, y, flipped);
76 }
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
int horizontal(const SkDLine &, double left, double right, double y, bool flipped)
struct MyStruct a[10]
double y
AI float conic(float tolerance, const SkPoint pts[], float w, const VectorXform &vectorXform=VectorXform())

◆ conicLine()

int SkIntersections::conicLine ( const SkPoint  a[3],
SkScalar  weight,
const SkPoint  b[2] 
)
inline

Definition at line 86 of file SkIntersections.h.

86 {
88 conic.set(a, weight);
90 line.set(b);
91 fMax = 3; // 2; permit small coincident segment + non-coincident intersection
92 return intersect(conic, line);
93 }
int intersect(const SkDLine &, const SkDLine &)
static bool b

◆ conicVertical()

int SkIntersections::conicVertical ( const SkPoint  a[3],
SkScalar  weight,
SkScalar  top,
SkScalar  bottom,
SkScalar  x,
bool  flipped 
)
inline

Definition at line 78 of file SkIntersections.h.

79 {
81 conic.set(a, weight);
82 fMax = 2;
83 return vertical(conic, top, bottom, x, flipped);
84 }
int vertical(const SkDLine &, double top, double bottom, double x, bool flipped)
double x

◆ cubicHorizontal()

int SkIntersections::cubicHorizontal ( const SkPoint  a[4],
SkScalar  left,
SkScalar  right,
SkScalar  y,
bool  flipped 
)
inline

Definition at line 95 of file SkIntersections.h.

96 {
98 cubic.set(a);
99 fMax = 3;
100 return horizontal(cubic, left, right, y, flipped);
101 }
AI float cubic(float precision, const SkPoint pts[], const VectorXform &vectorXform=VectorXform())

◆ cubicInsert()

void SkIntersections::cubicInsert ( double  one,
double  two,
const SkDPoint pt,
const SkDCubic c1,
const SkDCubic c2 
)

◆ cubicLine()

int SkIntersections::cubicLine ( const SkPoint  a[4],
const SkPoint  b[2] 
)
inline

Definition at line 110 of file SkIntersections.h.

110 {
112 cubic.set(a);
114 line.set(b);
115 fMax = 3;
116 return intersect(cubic, line);
117 }

◆ cubicVertical()

int SkIntersections::cubicVertical ( const SkPoint  a[4],
SkScalar  top,
SkScalar  bottom,
SkScalar  x,
bool  flipped 
)
inline

Definition at line 103 of file SkIntersections.h.

103 {
105 cubic.set(a);
106 fMax = 3;
107 return vertical(cubic, top, bottom, x, flipped);
108 }

◆ debugBumpLoopCount()

void SkIntersections::debugBumpLoopCount ( DebugLoop  )

◆ debugCoincidentUsed()

int SkIntersections::debugCoincidentUsed ( ) const

Definition at line 2656 of file SkPathOpsDebug.cpp.

2656 {
2657 if (!fIsCoincident[0]) {
2658 SkASSERT(!fIsCoincident[1]);
2659 return 0;
2660 }
2661 int count = 0;
2662 SkDEBUGCODE(int count2 = 0;)
2663 for (int index = 0; index < fUsed; ++index) {
2664 if (fIsCoincident[0] & (1 << index)) {
2665 ++count;
2666 }
2667#ifdef SK_DEBUG
2668 if (fIsCoincident[1] & (1 << index)) {
2669 ++count2;
2670 }
2671#endif
2672 }
2673 SkASSERT(count == count2);
2674 return count;
2675}
int count
#define SkDEBUGCODE(...)
Definition SkDebug.h:23

◆ debugLoopCount()

int SkIntersections::debugLoopCount ( DebugLoop  ) const

◆ debugResetLoopCount()

void SkIntersections::debugResetLoopCount ( )

◆ depth()

int SkIntersections::depth ( ) const
inline

Definition at line 301 of file SkIntersections.h.

301 {
302#ifdef SK_DEBUG
303 return fDepth;
304#else
305 return 0;
306#endif
307 }

◆ downDepth()

void SkIntersections::downDepth ( )
inline

Definition at line 232 of file SkIntersections.h.

232 {
233 SkASSERT(--fDepth >= 0);
234 }

◆ dump()

void SkIntersections::dump ( ) const

Definition at line 226 of file PathOpsDebug.cpp.

226 {
227 SkDebugf("used=%d of %d", fUsed, fMax);
228 for (int index = 0; index < fUsed; ++index) {
229 SkDebugf(" t=(%s%1.9g,%s%1.9g) pt=(%1.9g,%1.9g)",
230 fIsCoincident[0] & (1 << index) ? "*" : "", fT[0][index],
231 fIsCoincident[1] & (1 << index) ? "*" : "", fT[1][index],
232 fPt[index].fX, fPt[index].fY);
233 if (index < 2 && fNearlySame[index]) {
234 SkDebugf(" pt2=(%1.9g,%1.9g)",fPt2[index].fX, fPt2[index].fY);
235 }
236 }
237 SkDebugf("\n");
238}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1

◆ flip()

void SkIntersections::flip ( )

Definition at line 30 of file SkIntersections.cpp.

30 {
31 for (int index = 0; index < fUsed; ++index) {
32 fT[1][index] = 1 - fT[1][index];
33 }
34}

◆ hasOppT()

bool SkIntersections::hasOppT ( double  t) const
inline

Definition at line 128 of file SkIntersections.h.

128 {
129 SkASSERT(t == 0 || t == 1);
130 return fUsed > 0 && (fT[1][0] == t || fT[1][fUsed - 1] == t);
131 }

◆ hasT()

bool SkIntersections::hasT ( double  t) const
inline

Definition at line 123 of file SkIntersections.h.

123 {
124 SkASSERT(t == 0 || t == 1);
125 return fUsed > 0 && (t == 0 ? fT[0][0] == 0 : fT[0][fUsed - 1] == 1);
126 }

◆ horizontal() [1/7]

int SkIntersections::horizontal ( const SkDConic conic,
double  left,
double  right,
double  y,
bool  flipped 
)

Definition at line 359 of file SkDConicLineIntersection.cpp.

360 {
361 SkDLine line = {{{ left, y }, { right, y }}};
362 LineConicIntersections c(conic, line, this);
363 return c.horizontalIntersect(y, left, right, flipped);
364}

◆ horizontal() [2/7]

int SkIntersections::horizontal ( const SkDCubic cubic,
double  left,
double  right,
double  y,
bool  flipped 
)

Definition at line 427 of file SkDCubicLineIntersection.cpp.

428 {
429 SkDLine line = {{{ left, y }, { right, y }}};
430 LineCubicIntersections c(cubic, line, this);
431 return c.horizontalIntersect(y, left, right, flipped);
432}

◆ horizontal() [3/7]

int SkIntersections::horizontal ( const SkDCubic ,
double  left,
double  right,
double  y,
double  tRange[3] 
)

◆ horizontal() [4/7]

int SkIntersections::horizontal ( const SkDCubic ,
double  y,
double  tRange[3] 
)

◆ horizontal() [5/7]

int SkIntersections::horizontal ( const SkDLine line,
double  left,
double  right,
double  y,
bool  flipped 
)

Definition at line 209 of file SkDLineIntersection.cpp.

210 {
211 fMax = 3; // clean up parallel at the end will limit the result to 2 at the most
212 // see if end points intersect the opposite line
213 double t;
214 const SkDPoint leftPt = { left, y };
215 if ((t = line.exactPoint(leftPt)) >= 0) {
216 insert(t, (double) flipped, leftPt);
217 }
218 if (left != right) {
219 const SkDPoint rightPt = { right, y };
220 if ((t = line.exactPoint(rightPt)) >= 0) {
221 insert(t, (double) !flipped, rightPt);
222 }
223 for (int index = 0; index < 2; ++index) {
224 if ((t = SkDLine::ExactPointH(line[index], left, right, y)) >= 0) {
225 insert((double) index, flipped ? 1 - t : t, line[index]);
226 }
227 }
228 }
229 int result = horizontal_coincident(line, y);
230 if (result == 1 && fUsed == 0) {
231 fT[0][0] = HorizontalIntercept(line, y);
232 double xIntercept = line[0].fX + fT[0][0] * (line[1].fX - line[0].fX);
233 if (between(left, xIntercept, right)) {
234 fT[1][0] = (xIntercept - left) / (right - left);
235 if (flipped) {
236 // OPTIMIZATION: ? instead of swapping, pass original line, use [1].fX - [0].fX
237 for (int index = 0; index < result; ++index) {
238 fT[1][index] = 1 - fT[1][index];
239 }
240 }
241 fPt[0].fX = xIntercept;
242 fPt[0].fY = y;
243 fUsed = 1;
244 }
245 }
246 if (fAllowNear || result == 2) {
247 if ((t = line.nearPoint(leftPt, nullptr)) >= 0) {
248 insert(t, (double) flipped, leftPt);
249 }
250 if (left != right) {
251 const SkDPoint rightPt = { right, y };
252 if ((t = line.nearPoint(rightPt, nullptr)) >= 0) {
253 insert(t, (double) !flipped, rightPt);
254 }
255 for (int index = 0; index < 2; ++index) {
256 if ((t = SkDLine::NearPointH(line[index], left, right, y)) >= 0) {
257 insert((double) index, flipped ? 1 - t : t, line[index]);
258 }
259 }
260 }
261 }
262 cleanUpParallelLines(result == 2);
263 return fUsed;
264}
static int horizontal_coincident(const SkDLine &line, double y)
int insert(double one, double two, const SkDPoint &pt)
static double HorizontalIntercept(const SkDLine &line, double y)
GAsyncResult * result
static double NearPointH(const SkDPoint &xy, double left, double right, double y)
static double ExactPointH(const SkDPoint &xy, double left, double right, double y)

◆ horizontal() [6/7]

int SkIntersections::horizontal ( const SkDQuad quad,
double  left,
double  right,
double  y,
bool  flipped 
)

Definition at line 431 of file SkDQuadLineIntersection.cpp.

432 {
433 SkDLine line = {{{ left, y }, { right, y }}};
434 LineQuadraticIntersections q(quad, line, this);
435 return q.horizontalIntersect(y, left, right, flipped);
436}

◆ horizontal() [7/7]

int SkIntersections::horizontal ( const SkDQuad ,
double  left,
double  right,
double  y,
double  tRange[2] 
)

◆ HorizontalIntercept() [1/3]

int SkIntersections::HorizontalIntercept ( const SkDConic conic,
SkScalar  y,
double *  roots 
)
static

Definition at line 388 of file SkDConicLineIntersection.cpp.

388 {
389 LineConicIntersections c(conic);
390 return c.horizontalIntersect(y, roots);
391}

◆ HorizontalIntercept() [2/3]

double SkIntersections::HorizontalIntercept ( const SkDLine line,
double  y 
)
static

Definition at line 204 of file SkDLineIntersection.cpp.

204 {
205 SkASSERT(line[1].fY != line[0].fY);
206 return SkPinT((y - line[0].fY) / (line[1].fY - line[0].fY));
207}
double SkPinT(double t)

◆ HorizontalIntercept() [3/3]

int SkIntersections::HorizontalIntercept ( const SkDQuad quad,
SkScalar  y,
double *  roots 
)
static

Definition at line 460 of file SkDQuadLineIntersection.cpp.

460 {
462 return q.horizontalIntersect(y, roots);
463}

◆ insert()

int SkIntersections::insert ( double  one,
double  two,
const SkDPoint pt 
)

Definition at line 36 of file SkIntersections.cpp.

36 {
37 if (fIsCoincident[0] == 3 && between(fT[0][0], one, fT[0][1])) {
38 // For now, don't allow a mix of coincident and non-coincident intersections
39 return -1;
40 }
41 SkASSERT(fUsed <= 1 || fT[0][0] <= fT[0][1]);
42 int index;
43 for (index = 0; index < fUsed; ++index) {
44 double oldOne = fT[0][index];
45 double oldTwo = fT[1][index];
46 if (one == oldOne && two == oldTwo) {
47 return -1;
48 }
49 if (more_roughly_equal(oldOne, one) && more_roughly_equal(oldTwo, two)) {
50 if ((!precisely_zero(one) || precisely_zero(oldOne))
51 && (!precisely_equal(one, 1) || precisely_equal(oldOne, 1))
52 && (!precisely_zero(two) || precisely_zero(oldTwo))
53 && (!precisely_equal(two, 1) || precisely_equal(oldTwo, 1))) {
54 return -1;
55 }
56 SkASSERT(one >= 0 && one <= 1);
57 SkASSERT(two >= 0 && two <= 1);
58 // remove this and reinsert below in case replacing would make list unsorted
59 int remaining = fUsed - index - 1;
60 memmove(&fPt[index], &fPt[index + 1], sizeof(fPt[0]) * remaining);
61 memmove(&fT[0][index], &fT[0][index + 1], sizeof(fT[0][0]) * remaining);
62 memmove(&fT[1][index], &fT[1][index + 1], sizeof(fT[1][0]) * remaining);
63 int clearMask = ~((1 << index) - 1);
64 fIsCoincident[0] -= (fIsCoincident[0] >> 1) & clearMask;
65 fIsCoincident[1] -= (fIsCoincident[1] >> 1) & clearMask;
66 --fUsed;
67 break;
68 }
69 #if ONE_OFF_DEBUG
70 if (pt.roughlyEqual(fPt[index])) {
71 SkDebugf("%s t=%1.9g pts roughly equal\n", __FUNCTION__, one);
72 }
73 #endif
74 }
75 for (index = 0; index < fUsed; ++index) {
76 if (fT[0][index] > one) {
77 break;
78 }
79 }
80 if (fUsed >= fMax) {
81 SkOPASSERT(0); // FIXME : this error, if it is to be handled at runtime in release, must
82 // be propagated all the way back down to the caller, and return failure.
83 fUsed = 0;
84 return 0;
85 }
86 int remaining = fUsed - index;
87 if (remaining > 0) {
88 memmove(&fPt[index + 1], &fPt[index], sizeof(fPt[0]) * remaining);
89 memmove(&fT[0][index + 1], &fT[0][index], sizeof(fT[0][0]) * remaining);
90 memmove(&fT[1][index + 1], &fT[1][index], sizeof(fT[1][0]) * remaining);
91 int clearMask = ~((1 << index) - 1);
92 fIsCoincident[0] += fIsCoincident[0] & clearMask;
93 fIsCoincident[1] += fIsCoincident[1] & clearMask;
94 }
95 fPt[index] = pt;
96 if (one < 0 || one > 1) {
97 return -1;
98 }
99 if (two < 0 || two > 1) {
100 return -1;
101 }
102 fT[0][index] = one;
103 fT[1][index] = two;
104 ++fUsed;
105 SkASSERT(fUsed <= std::size(fPt));
106 return index;
107}
bool precisely_zero(double x)
#define SkOPASSERT(cond)
bool precisely_equal(double x, double y)
bool more_roughly_equal(double x, double y)
const SkDPoint & pt(int index) const
bool roughlyEqual(const SkDPoint &a) const

◆ insertCoincident()

int SkIntersections::insertCoincident ( double  one,
double  two,
const SkDPoint pt 
)

Definition at line 118 of file SkIntersections.cpp.

118 {
119 int index = insertSwap(one, two, pt);
120 if (index >= 0) {
121 setCoincident(index);
122 }
123 return index;
124}
int insertSwap(double one, double two, const SkDPoint &pt)
void setCoincident(int index)

◆ insertNear()

void SkIntersections::insertNear ( double  one,
double  two,
const SkDPoint pt1,
const SkDPoint pt2 
)

Definition at line 109 of file SkIntersections.cpp.

109 {
110 SkASSERT(one == 0 || one == 1);
111 SkASSERT(two == 0 || two == 1);
112 SkASSERT(pt1 != pt2);
113 fNearlySame[one ? 1 : 0] = true;
114 (void) insert(one, two, pt1);
115 fPt2[one ? 1 : 0] = pt2;
116}
const SkDPoint & pt2(int index) const

◆ insertSwap()

int SkIntersections::insertSwap ( double  one,
double  two,
const SkDPoint pt 
)
inline

Definition at line 133 of file SkIntersections.h.

133 {
134 if (fSwap) {
135 return insert(two, one, pt);
136 } else {
137 return insert(one, two, pt);
138 }
139 }

◆ intersect() [1/10]

int SkIntersections::intersect ( const SkDConic c1,
const SkDConic c2 
)

Definition at line 2116 of file SkPathOpsTSect.cpp.

2116 {
2117 SkTConic conic1(c1);
2118 SkTConic conic2(c2);
2119 SkTSect sect1(conic1 SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
2120 SkTSect sect2(conic2 SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(2));
2121 SkTSect::BinarySearch(&sect1, &sect2, this);
2122 return used();
2123}
#define PATH_OPS_DEBUG_T_SECT_PARAMS(...)
static void BinarySearch(SkTSect *sect1, SkTSect *sect2, SkIntersections *intersections)

◆ intersect() [2/10]

int SkIntersections::intersect ( const SkDConic conic,
const SkDLine line 
)

Definition at line 373 of file SkDConicLineIntersection.cpp.

373 {
374 LineConicIntersections c(conic, line, this);
375 c.allowNear(fAllowNear);
376 return c.intersect();
377}

◆ intersect() [3/10]

int SkIntersections::intersect ( const SkDConic c,
const SkDQuad q 
)

Definition at line 2107 of file SkPathOpsTSect.cpp.

2107 {
2108 SkTConic conic(c);
2109 SkTQuad quad(q);
2110 SkTSect sect1(conic SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
2111 SkTSect sect2(quad SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(2));
2112 SkTSect::BinarySearch(&sect1, &sect2, this);
2113 return used();
2114}

◆ intersect() [4/10]

int SkIntersections::intersect ( const SkDCubic cu,
const SkDConic co 
)

Definition at line 2134 of file SkPathOpsTSect.cpp.

2134 {
2135 SkTCubic cubic(cu);
2136 SkTConic conic(co);
2137 SkTSect sect1(cubic SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
2138 SkTSect sect2(conic SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(2));
2139 SkTSect::BinarySearch(&sect1, &sect2, this);
2140 return used();
2141
2142}

◆ intersect() [5/10]

int SkIntersections::intersect ( const SkDCubic c1,
const SkDCubic c2 
)

Definition at line 2144 of file SkPathOpsTSect.cpp.

2144 {
2145 SkTCubic cubic1(c1);
2146 SkTCubic cubic2(c2);
2147 SkTSect sect1(cubic1 SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
2148 SkTSect sect2(cubic2 SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(2));
2149 SkTSect::BinarySearch(&sect1, &sect2, this);
2150 return used();
2151}

◆ intersect() [6/10]

int SkIntersections::intersect ( const SkDCubic cubic,
const SkDLine line 
)

Definition at line 441 of file SkDCubicLineIntersection.cpp.

441 {
442 LineCubicIntersections c(cubic, line, this);
443 c.allowNear(fAllowNear);
444 return c.intersect();
445}

◆ intersect() [7/10]

int SkIntersections::intersect ( const SkDCubic c,
const SkDQuad q 
)

Definition at line 2125 of file SkPathOpsTSect.cpp.

2125 {
2126 SkTCubic cubic(c);
2127 SkTQuad quad(q);
2128 SkTSect sect1(cubic SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
2129 SkTSect sect2(quad SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(2));
2130 SkTSect::BinarySearch(&sect1, &sect2, this);
2131 return used();
2132}

◆ intersect() [8/10]

int SkIntersections::intersect ( const SkDLine a,
const SkDLine b 
)

Definition at line 87 of file SkDLineIntersection.cpp.

87 {
88 fMax = 3; // note that we clean up so that there is no more than two in the end
89 // see if end points intersect the opposite line
90 double t;
91 for (int iA = 0; iA < 2; ++iA) {
92 if ((t = b.exactPoint(a[iA])) >= 0) {
93 insert(iA, t, a[iA]);
94 }
95 }
96 for (int iB = 0; iB < 2; ++iB) {
97 if ((t = a.exactPoint(b[iB])) >= 0) {
98 insert(t, iB, b[iB]);
99 }
100 }
101 /* Determine the intersection point of two line segments
102 Return FALSE if the lines don't intersect
103 from: http://paulbourke.net/geometry/lineline2d/ */
104 double axLen = a[1].fX - a[0].fX;
105 double ayLen = a[1].fY - a[0].fY;
106 double bxLen = b[1].fX - b[0].fX;
107 double byLen = b[1].fY - b[0].fY;
108 /* Slopes match when denom goes to zero:
109 axLen / ayLen == bxLen / byLen
110 (ayLen * byLen) * axLen / ayLen == (ayLen * byLen) * bxLen / byLen
111 byLen * axLen == ayLen * bxLen
112 byLen * axLen - ayLen * bxLen == 0 ( == denom )
113 */
114 double axByLen = axLen * byLen;
115 double ayBxLen = ayLen * bxLen;
116 // detect parallel lines the same way here and in SkOpAngle operator <
117 // so that non-parallel means they are also sortable
118 bool unparallel = fAllowNear ? NotAlmostEqualUlps_Pin(axByLen, ayBxLen)
119 : NotAlmostDequalUlps(axByLen, ayBxLen);
120 if (unparallel && fUsed == 0) {
121 double ab0y = a[0].fY - b[0].fY;
122 double ab0x = a[0].fX - b[0].fX;
123 double numerA = ab0y * bxLen - byLen * ab0x;
124 double numerB = ab0y * axLen - ayLen * ab0x;
125 double denom = axByLen - ayBxLen;
126 if (between(0, numerA, denom) && between(0, numerB, denom)) {
127 fT[0][0] = numerA / denom;
128 fT[1][0] = numerB / denom;
129 computePoints(a, 1);
130 }
131 }
132/* Allow tracking that both sets of end points are near each other -- the lines are entirely
133 coincident -- even when the end points are not exactly the same.
134 Mark this as a 'wild card' for the end points, so that either point is considered totally
135 coincident. Then, avoid folding the lines over each other, but allow either end to mate
136 to the next set of lines.
137 */
138 if (fAllowNear || !unparallel) {
139 double aNearB[2];
140 double bNearA[2];
141 bool aNotB[2] = {false, false};
142 bool bNotA[2] = {false, false};
143 int nearCount = 0;
144 for (int index = 0; index < 2; ++index) {
145 aNearB[index] = t = b.nearPoint(a[index], &aNotB[index]);
146 nearCount += t >= 0;
147 bNearA[index] = t = a.nearPoint(b[index], &bNotA[index]);
148 nearCount += t >= 0;
149 }
150 if (nearCount > 0) {
151 // Skip if each segment contributes to one end point.
152 if (nearCount != 2 || aNotB[0] == aNotB[1]) {
153 for (int iA = 0; iA < 2; ++iA) {
154 if (!aNotB[iA]) {
155 continue;
156 }
157 int nearer = aNearB[iA] > 0.5;
158 if (!bNotA[nearer]) {
159 continue;
160 }
161 SkASSERT(a[iA] != b[nearer]);
162 SkOPASSERT(iA == (bNearA[nearer] > 0.5));
163 insertNear(iA, nearer, a[iA], b[nearer]);
164 aNearB[iA] = -1;
165 bNearA[nearer] = -1;
166 nearCount -= 2;
167 }
168 }
169 if (nearCount > 0) {
170 for (int iA = 0; iA < 2; ++iA) {
171 if (aNearB[iA] >= 0) {
172 insert(iA, aNearB[iA], a[iA]);
173 }
174 }
175 for (int iB = 0; iB < 2; ++iB) {
176 if (bNearA[iB] >= 0) {
177 insert(bNearA[iB], iB, b[iB]);
178 }
179 }
180 }
181 }
182 }
183 cleanUpParallelLines(!unparallel);
184 SkASSERT(fUsed <= 2);
185 return fUsed;
186}
bool NotAlmostEqualUlps_Pin(float a, float b)
bool NotAlmostDequalUlps(float a, float b)
void insertNear(double one, double two, const SkDPoint &pt1, const SkDPoint &pt2)

◆ intersect() [9/10]

int SkIntersections::intersect ( const SkDQuad quad,
const SkDLine line 
)

Definition at line 445 of file SkDQuadLineIntersection.cpp.

445 {
446 LineQuadraticIntersections q(quad, line, this);
447 q.allowNear(fAllowNear);
448 return q.intersect();
449}

◆ intersect() [10/10]

int SkIntersections::intersect ( const SkDQuad q1,
const SkDQuad q2 
)

Definition at line 2098 of file SkPathOpsTSect.cpp.

2098 {
2099 SkTQuad quad1(q1);
2100 SkTQuad quad2(q2);
2101 SkTSect sect1(quad1 SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
2102 SkTSect sect2(quad2 SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(2));
2103 SkTSect::BinarySearch(&sect1, &sect2, this);
2104 return used();
2105}

◆ intersectRay() [1/5]

int SkIntersections::intersectRay ( const SkDConic conic,
const SkDLine line 
)

Definition at line 379 of file SkDConicLineIntersection.cpp.

379 {
380 LineConicIntersections c(conic, line, this);
381 fUsed = c.intersectRay(fT[0]);
382 for (int index = 0; index < fUsed; ++index) {
383 fPt[index] = conic.ptAtT(fT[0][index]);
384 }
385 return fUsed;
386}

◆ intersectRay() [2/5]

int SkIntersections::intersectRay ( const SkDCubic cubic,
const SkDLine line 
)

Definition at line 447 of file SkDCubicLineIntersection.cpp.

447 {
448 LineCubicIntersections c(cubic, line, this);
449 fUsed = c.intersectRay(fT[0]);
450 for (int index = 0; index < fUsed; ++index) {
451 fPt[index] = cubic.ptAtT(fT[0][index]);
452 }
453 return fUsed;
454}

◆ intersectRay() [3/5]

int SkIntersections::intersectRay ( const SkDLine a,
const SkDLine b 
)

Definition at line 46 of file SkDLineIntersection.cpp.

46 {
47 fMax = 2;
48 SkDVector aLen = a[1] - a[0];
49 SkDVector bLen = b[1] - b[0];
50 /* Slopes match when denom goes to zero:
51 axLen / ayLen == bxLen / byLen
52 (ayLen * byLen) * axLen / ayLen == (ayLen * byLen) * bxLen / byLen
53 byLen * axLen == ayLen * bxLen
54 byLen * axLen - ayLen * bxLen == 0 ( == denom )
55 */
56 double denom = bLen.fY * aLen.fX - aLen.fY * bLen.fX;
57 int used;
58 if (!approximately_zero(denom)) {
59 SkDVector ab0 = a[0] - b[0];
60 double numerA = ab0.fY * bLen.fX - bLen.fY * ab0.fX;
61 double numerB = ab0.fY * aLen.fX - aLen.fY * ab0.fX;
62 numerA /= denom;
63 numerB /= denom;
64 fT[0][0] = numerA;
65 fT[1][0] = numerB;
66 used = 1;
67 } else {
68 /* See if the axis intercepts match:
69 ay - ax * ayLen / axLen == by - bx * ayLen / axLen
70 axLen * (ay - ax * ayLen / axLen) == axLen * (by - bx * ayLen / axLen)
71 axLen * ay - ax * ayLen == axLen * by - bx * ayLen
72 */
73 if (!AlmostEqualUlps(aLen.fX * a[0].fY - aLen.fY * a[0].fX,
74 aLen.fX * b[0].fY - aLen.fY * b[0].fX)) {
75 return fUsed = 0;
76 }
77 // there's no great answer for intersection points for coincident rays, but return something
78 fT[0][0] = fT[1][0] = 0;
79 fT[1][0] = fT[1][1] = 1;
80 used = 2;
81 }
82 computePoints(a, used);
83 return fUsed;
84}
static bool approximately_zero(double x)
Definition SkCubics.cpp:153
bool AlmostEqualUlps(const SkPoint &pt1, const SkPoint &pt2)

◆ intersectRay() [4/5]

int SkIntersections::intersectRay ( const SkDQuad quad,
const SkDLine line 
)

Definition at line 451 of file SkDQuadLineIntersection.cpp.

451 {
452 LineQuadraticIntersections q(quad, line, this);
453 fUsed = q.intersectRay(fT[0]);
454 for (int index = 0; index < fUsed; ++index) {
455 fPt[index] = quad.ptAtT(fT[0][index]);
456 }
457 return fUsed;
458}
SkDPoint ptAtT(double t) const

◆ intersectRay() [5/5]

int SkIntersections::intersectRay ( const SkTCurve tCurve,
const SkDLine line 
)
inline

Definition at line 285 of file SkIntersections.h.

285 {
286 return tCurve.intersectRay(this, line);
287 }
virtual int intersectRay(SkIntersections *i, const SkDLine &line) const =0

◆ isCoincident()

bool SkIntersections::isCoincident ( int  index)
inline

Definition at line 141 of file SkIntersections.h.

141 {
142 return (fIsCoincident[0] & 1 << index) != 0;
143 }

◆ lineHorizontal()

int SkIntersections::lineHorizontal ( const SkPoint  a[2],
SkScalar  left,
SkScalar  right,
SkScalar  y,
bool  flipped 
)
inline

Definition at line 145 of file SkIntersections.h.

146 {
148 line.set(a);
149 fMax = 2;
150 return horizontal(line, left, right, y, flipped);
151 }

◆ lineLine()

int SkIntersections::lineLine ( const SkPoint  a[2],
const SkPoint  b[2] 
)
inline

Definition at line 160 of file SkIntersections.h.

160 {
161 SkDLine aLine, bLine;
162 aLine.set(a);
163 bLine.set(b);
164 fMax = 2;
165 return intersect(aLine, bLine);
166 }
const SkDLine & set(const SkPoint pts[2])

◆ lineVertical()

int SkIntersections::lineVertical ( const SkPoint  a[2],
SkScalar  top,
SkScalar  bottom,
SkScalar  x,
bool  flipped 
)
inline

Definition at line 153 of file SkIntersections.h.

153 {
155 line.set(a);
156 fMax = 2;
157 return vertical(line, top, bottom, x, flipped);
158 }

◆ merge()

void SkIntersections::merge ( const SkIntersections a,
int  aIndex,
const SkIntersections b,
int  bIndex 
)

Definition at line 133 of file SkIntersections.cpp.

134 {
135 this->reset();
136 fT[0][0] = a.fT[0][aIndex];
137 fT[1][0] = b.fT[0][bIndex];
138 fPt[0] = a.fPt[aIndex];
139 fPt2[0] = b.fPt[bIndex];
140 fUsed = 1;
141}

◆ mostOutside()

int SkIntersections::mostOutside ( double  rangeStart,
double  rangeEnd,
const SkDPoint origin 
) const

Definition at line 143 of file SkIntersections.cpp.

143 {
144 int result = -1;
145 for (int index = 0; index < fUsed; ++index) {
146 if (!between(rangeStart, fT[0][index], rangeEnd)) {
147 continue;
148 }
149 if (result < 0) {
150 result = index;
151 continue;
152 }
153 SkDVector best = fPt[result] - origin;
154 SkDVector test = fPt[index] - origin;
155 if (test.crossCheck(best) < 0) {
156 result = index;
157 }
158 }
159 return result;
160}

◆ nearlySame()

bool SkIntersections::nearlySame ( int  index) const
inline

Definition at line 168 of file SkIntersections.h.

168 {
169 SkASSERT(index == 0 || index == 1);
170 return fNearlySame[index];
171 }

◆ operator[]()

TArray SkIntersections::operator[] ( int  n) const
inline

Definition at line 57 of file SkIntersections.h.

57{ return TArray(fT[n]); }

◆ pt()

const SkDPoint & SkIntersections::pt ( int  index) const
inline

Definition at line 173 of file SkIntersections.h.

173 {
174 return fPt[index];
175 }

◆ pt2()

const SkDPoint & SkIntersections::pt2 ( int  index) const
inline

Definition at line 177 of file SkIntersections.h.

177 {
178 return fPt2[index];
179 }

◆ quadHorizontal()

int SkIntersections::quadHorizontal ( const SkPoint  a[3],
SkScalar  left,
SkScalar  right,
SkScalar  y,
bool  flipped 
)
inline

Definition at line 181 of file SkIntersections.h.

182 {
183 SkDQuad quad;
184 quad.set(a);
185 fMax = 2;
186 return horizontal(quad, left, right, y, flipped);
187 }
const SkDQuad & set(const SkPoint pts[kPointCount] SkDEBUGPARAMS(SkOpGlobalState *state=nullptr))

◆ quadLine()

int SkIntersections::quadLine ( const SkPoint  a[3],
const SkPoint  b[2] 
)
inline

Definition at line 196 of file SkIntersections.h.

196 {
197 SkDQuad quad;
198 quad.set(a);
200 line.set(b);
201 return intersect(quad, line);
202 }

◆ quadVertical()

int SkIntersections::quadVertical ( const SkPoint  a[3],
SkScalar  top,
SkScalar  bottom,
SkScalar  x,
bool  flipped 
)
inline

Definition at line 189 of file SkIntersections.h.

189 {
190 SkDQuad quad;
191 quad.set(a);
192 fMax = 2;
193 return vertical(quad, top, bottom, x, flipped);
194 }

◆ removeOne()

void SkIntersections::removeOne ( int  index)

Definition at line 162 of file SkIntersections.cpp.

162 {
163 int remaining = --fUsed - index;
164 if (remaining <= 0) {
165 return;
166 }
167 memmove(&fPt[index], &fPt[index + 1], sizeof(fPt[0]) * remaining);
168 memmove(&fT[0][index], &fT[0][index + 1], sizeof(fT[0][0]) * remaining);
169 memmove(&fT[1][index], &fT[1][index + 1], sizeof(fT[1][0]) * remaining);
170// SkASSERT(fIsCoincident[0] == 0);
171 int coBit = fIsCoincident[0] & (1 << index);
172 fIsCoincident[0] -= ((fIsCoincident[0] >> 1) & ~((1 << index) - 1)) + coBit;
173 SkASSERT(!(coBit ^ (fIsCoincident[1] & (1 << index))));
174 fIsCoincident[1] -= ((fIsCoincident[1] >> 1) & ~((1 << index) - 1)) + coBit;
175}

◆ reset()

void SkIntersections::reset ( )
inline

Definition at line 205 of file SkIntersections.h.

205 {
206 fAllowNear = true;
207 fUsed = 0;
208 sk_bzero(fIsCoincident, sizeof(fIsCoincident));
209 }

◆ set()

void SkIntersections::set ( bool  swap,
int  tIndex,
double  t 
)
inline

Definition at line 211 of file SkIntersections.h.

211 {
212 fT[(int) swap][tIndex] = t;
213 }
Type::kYUV Type::kRGBA() int(0.7 *637)

◆ setCoincident()

void SkIntersections::setCoincident ( int  index)

Definition at line 126 of file SkIntersections.cpp.

126 {
127 SkASSERT(index >= 0);
128 int bit = 1 << index;
129 fIsCoincident[0] |= bit;
130 fIsCoincident[1] |= bit;
131}

◆ setMax()

void SkIntersections::setMax ( int  max)
inline

Definition at line 215 of file SkIntersections.h.

215 {
216 SkASSERT(max <= (int) std::size(fPt));
217 fMax = max;
218 }
static float max(float r, float g, float b)
Definition hsl.cpp:49

◆ swap()

void SkIntersections::swap ( )
inline

Definition at line 220 of file SkIntersections.h.

220 {
221 fSwap ^= true;
222 }

◆ swapped()

bool SkIntersections::swapped ( ) const
inline

Definition at line 224 of file SkIntersections.h.

224 {
225 return fSwap;
226 }

◆ unBumpT()

bool SkIntersections::unBumpT ( int  index)
inline

Definition at line 236 of file SkIntersections.h.

236 {
237 SkASSERT(fUsed == 1);
238 fT[0][index] = fT[0][index] * (1 + BUMP_EPSILON * 2) - BUMP_EPSILON;
239 if (!between(0, fT[0][index], 1)) {
240 fUsed = 0;
241 return false;
242 }
243 return true;
244 }
const double BUMP_EPSILON

◆ upDepth()

void SkIntersections::upDepth ( )
inline

Definition at line 246 of file SkIntersections.h.

246 {
247 SkASSERT(++fDepth < 16);
248 }

◆ used()

int SkIntersections::used ( ) const
inline

Definition at line 228 of file SkIntersections.h.

228 {
229 return fUsed;
230 }

◆ vertical() [1/4]

int SkIntersections::vertical ( const SkDConic conic,
double  top,
double  bottom,
double  x,
bool  flipped 
)

Definition at line 366 of file SkDConicLineIntersection.cpp.

367 {
368 SkDLine line = {{{ x, top }, { x, bottom }}};
369 LineConicIntersections c(conic, line, this);
370 return c.verticalIntersect(x, top, bottom, flipped);
371}

◆ vertical() [2/4]

int SkIntersections::vertical ( const SkDCubic cubic,
double  top,
double  bottom,
double  x,
bool  flipped 
)

Definition at line 434 of file SkDCubicLineIntersection.cpp.

435 {
436 SkDLine line = {{{ x, top }, { x, bottom }}};
437 LineCubicIntersections c(cubic, line, this);
438 return c.verticalIntersect(x, top, bottom, flipped);
439}

◆ vertical() [3/4]

int SkIntersections::vertical ( const SkDLine line,
double  top,
double  bottom,
double  x,
bool  flipped 
)

Definition at line 287 of file SkDLineIntersection.cpp.

288 {
289 fMax = 3; // cleanup parallel lines will bring this back line
290 // see if end points intersect the opposite line
291 double t;
292 SkDPoint topPt = { x, top };
293 if ((t = line.exactPoint(topPt)) >= 0) {
294 insert(t, (double) flipped, topPt);
295 }
296 if (top != bottom) {
297 SkDPoint bottomPt = { x, bottom };
298 if ((t = line.exactPoint(bottomPt)) >= 0) {
299 insert(t, (double) !flipped, bottomPt);
300 }
301 for (int index = 0; index < 2; ++index) {
302 if ((t = SkDLine::ExactPointV(line[index], top, bottom, x)) >= 0) {
303 insert((double) index, flipped ? 1 - t : t, line[index]);
304 }
305 }
306 }
307 int result = vertical_coincident(line, x);
308 if (result == 1 && fUsed == 0) {
309 fT[0][0] = VerticalIntercept(line, x);
310 double yIntercept = line[0].fY + fT[0][0] * (line[1].fY - line[0].fY);
311 if (between(top, yIntercept, bottom)) {
312 fT[1][0] = (yIntercept - top) / (bottom - top);
313 if (flipped) {
314 // OPTIMIZATION: instead of swapping, pass original line, use [1].fY - [0].fY
315 for (int index = 0; index < result; ++index) {
316 fT[1][index] = 1 - fT[1][index];
317 }
318 }
319 fPt[0].fX = x;
320 fPt[0].fY = yIntercept;
321 fUsed = 1;
322 }
323 }
324 if (fAllowNear || result == 2) {
325 if ((t = line.nearPoint(topPt, nullptr)) >= 0) {
326 insert(t, (double) flipped, topPt);
327 }
328 if (top != bottom) {
329 SkDPoint bottomPt = { x, bottom };
330 if ((t = line.nearPoint(bottomPt, nullptr)) >= 0) {
331 insert(t, (double) !flipped, bottomPt);
332 }
333 for (int index = 0; index < 2; ++index) {
334 if ((t = SkDLine::NearPointV(line[index], top, bottom, x)) >= 0) {
335 insert((double) index, flipped ? 1 - t : t, line[index]);
336 }
337 }
338 }
339 }
340 cleanUpParallelLines(result == 2);
341 SkASSERT(fUsed <= 2);
342 return fUsed;
343}
static int vertical_coincident(const SkDLine &line, double x)
static double VerticalIntercept(const SkDLine &line, double x)
static double ExactPointV(const SkDPoint &xy, double top, double bottom, double x)
static double NearPointV(const SkDPoint &xy, double top, double bottom, double x)

◆ vertical() [4/4]

int SkIntersections::vertical ( const SkDQuad quad,
double  top,
double  bottom,
double  x,
bool  flipped 
)

Definition at line 438 of file SkDQuadLineIntersection.cpp.

439 {
440 SkDLine line = {{{ x, top }, { x, bottom }}};
441 LineQuadraticIntersections q(quad, line, this);
442 return q.verticalIntersect(x, top, bottom, flipped);
443}

◆ VerticalIntercept() [1/3]

int SkIntersections::VerticalIntercept ( const SkDConic conic,
SkScalar  x,
double *  roots 
)
static

Definition at line 393 of file SkDConicLineIntersection.cpp.

393 {
394 LineConicIntersections c(conic);
395 return c.verticalIntersect(x, roots);
396}

◆ VerticalIntercept() [2/3]

double SkIntersections::VerticalIntercept ( const SkDLine line,
double  x 
)
static

Definition at line 282 of file SkDLineIntersection.cpp.

282 {
283 SkASSERT(line[1].fX != line[0].fX);
284 return SkPinT((x - line[0].fX) / (line[1].fX - line[0].fX));
285}

◆ VerticalIntercept() [3/3]

int SkIntersections::VerticalIntercept ( const SkDQuad quad,
SkScalar  x,
double *  roots 
)
static

Definition at line 465 of file SkDQuadLineIntersection.cpp.

465 {
467 return q.verticalIntersect(x, roots);
468}

The documentation for this class was generated from the following files: