56const char* gDebugRayDirName[] = {
65 return static_cast<int>(dir) & 1;
85 return (&r.
fLeft)[
static_cast<int>(dir)];
94 return static_cast<bool>((
static_cast<int>(dir) & 2) == 0);
98 bool vPartPos =
pt_dydx(v, dir) > 0;
99 bool leftBottom = ((
static_cast<int>(dir) + 1) & 2) != 0;
100 return vPartPos == leftBottom;
107 fT = span->
t() * (1 - t) + span->
next()->
t() * t;
135 }
while ((testSegment = testSegment->
next()));
152 for (
int index = 0; index < roots; ++index) {
153 double t = tVals[index];
169 if (
base.fSpan->segment() ==
this) {
182 SkDebugf(
"%s (rarely expect this)\n", __FUNCTION__);
186 if (fabs(
pt_dydx(slope, dir) * 10000) > fabs(
pt_dxdy(slope, dir))) {
198 newHit->
fNext = *hits;
201 newHit->
fSpan = span;
216 if (tHit < next->t()) {
219 }
while (!
next->final() && (span =
next->upCast()));
224 return a->fPt.fX <
b->fPt.fX;
228 return b->fPt.fX <
a->fPt.fX;
232 return a->fPt.fY <
b->fPt.fY;
236 return b->fPt.fY <
a->fPt.fY;
241 *dirOffset = tTry & 1;
242 int tBase = tTry >> 1;
249 int tIndex = (tBase - 1) & ((1 << tBits) - 1);
265 dir =
static_cast<SkOpRayDir>(
static_cast<int>(dir) + dirOffset);
275 contour->rayCheck(hitBase, dir, &hitHead, &allocator);
290 SkDebugf(
"%s dir=%s seg=%d t=%1.9g pt=(%1.9g,%1.9g)\n", __FUNCTION__,
293 for (
int index = 0; index <
count; ++index) {
297 bool operand = span ? hitSegment->
operand() :
false;
299 SkDebugf(
"%s [%d] valid=%d operand=%d span=%d ccw=%d ", __FUNCTION__, index,
304 SkDebugf(
" t=%1.9g pt=(%1.9g,%1.9g) slope=(%1.9g,%1.9g)\n", hit->
fT,
311 for (
int index = 0; index <
count; ++index) {
329 if (index <
count - 1) {
335 bool operand = hitSegment->
operand();
341 int lastOpp = oppWind;
357 || (abs(wind) == abs(lastWind)
358 && (
windSum ^ wind ^ lastWind) == spanSum));
361 int oSpanSum = span->
oppSum();
368 || (abs(oppWind) == abs(lastOpp)
369 && (
oppSum ^ oppWind ^ lastOpp) == oSpanSum));
404 }
while (!
next->final() && (span =
next->upCast()));
413 if (testSegment->
done()) {
421 }
while ((testSegment = testSegment->
next()));
static bool approximately_zero(double x)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static bool between(SkScalar a, SkScalar b, SkScalar c)
static void sk_bzero(void *buffer, size_t size)
static constexpr int32_t SK_MinS32
static int(*const CurveIntercept[])(const SkPoint[], SkScalar, SkScalar, double *)
bool approximately_equal(double x, double y)
bool roughly_equal(double x, double y)
bool approximately_between(double a, double b, double c)
int SkPathOpsVerbToPoints(SkPath::Verb verb)
static double get_t_guess(int tTry, int *dirOffset)
static bool hit_compare_x(const SkOpRayHit *a, const SkOpRayHit *b)
static bool ccw_dxdy(const SkDVector &v, SkOpRayDir dir)
static int xy_index(SkOpRayDir dir)
SkOpSpan * FindSortableTop(SkOpContourHead *contourHead)
static bool hit_compare_y(const SkOpRayHit *a, const SkOpRayHit *b)
static bool reverse_hit_compare_y(const SkOpRayHit *a, const SkOpRayHit *b)
static bool less_than(SkOpRayDir dir)
static SkScalar pt_xy(const SkPoint &pt, SkOpRayDir dir)
static double pt_dydx(const SkDVector &v, SkOpRayDir dir)
static bool sideways_overlap(const SkRect &rect, const SkPoint &pt, SkOpRayDir dir)
static bool reverse_hit_compare_x(const SkOpRayHit *a, const SkOpRayHit *b)
static SkScalar pt_yx(const SkPoint &pt, SkOpRayDir dir)
static double pt_dxdy(const SkDVector &v, SkOpRayDir dir)
static SkScalar rect_side(const SkRect &r, SkOpRayDir dir)
void swap(sk_sp< T > &a, sk_sp< T > &b)
void SkTQSort(T *begin, T *end, const C &lessThan)
auto make(Ctor &&ctor) -> decltype(ctor(nullptr))
SkOpSpan * findSortableTop(SkOpContour *)
void rayCheck(const SkOpRayHit &base, SkOpRayDir dir, SkOpRayHit **hits, SkArenaAlloc *)
SkDVector dSlopeAtT(double mid) const
void dumpPtsInner(const char *prefix="seg") const
SkPath::Verb verb() const
SkOpSpan * findSortableTop(SkOpContour *)
SkPoint ptAtT(double mid) const
void rayCheck(const SkOpRayHit &base, SkOpRayDir dir, SkOpRayHit **hits, SkArenaAlloc *)
bool markAndChaseWinding(SkOpSpanBase *start, SkOpSpanBase *end, int winding, SkOpSpanBase **lastPtr)
static bool UseInnerWinding(int outerWinding, int innerWinding)
SkOpSpan * windingSpanAtT(double tHit)
SkOpSegment * next() const
SkOpContour * contour() const
SkOpGlobalState * globalState() const
SkOpSegment * segment() const
bool sortableTop(SkOpContour *)
SkOpSpanBase * next() const
void setWindSum(int windSum)
void setOppSum(int oppSum)
static bool ApproximatelyEqual(const SkPoint &a, const SkPoint &b)
static bool RoughlyEqual(const SkPoint &a, const SkPoint &b)
SkOpRayDir makeTestBase(SkOpSpan *span, double t)
SkScalar fLeft
smaller x-axis bounds