#include <SkPathOpsTSect.h>
|
| SkTSpan (const SkTCurve &curve, SkArenaAlloc &heap) |
|
void | addBounded (SkTSpan *, SkArenaAlloc *) |
|
double | closestBoundedT (const SkDPoint &pt) const |
|
bool | contains (double t) const |
|
void | debugInit (const SkTCurve &curve, SkArenaAlloc &heap) |
|
const SkTSect * | debugOpp () const |
|
void | dump () const |
|
void | dumpAll () const |
|
void | dumpBounded (int id) const |
|
void | dumpBounds () const |
|
void | dumpCoin () const |
|
double | endT () const |
|
SkTSpan * | findOppSpan (const SkTSpan *opp) const |
|
SkTSpan * | findOppT (double t) const |
|
| SkDEBUGCODE (SkOpGlobalState *globalState() const { return fDebugGlobalState;}) bool hasOppT(double t) const |
|
int | hullsIntersect (SkTSpan *span, bool *start, bool *oppStart) |
|
void | init (const SkTCurve &) |
|
bool | initBounds (const SkTCurve &) |
|
bool | isBounded () const |
|
bool | linearsIntersect (SkTSpan *span) |
|
double | linearT (const SkDPoint &) const |
|
void | markCoincident () |
|
const SkTSpan * | next () const |
|
bool | onlyEndPointsInCommon (const SkTSpan *opp, bool *start, bool *oppStart, bool *ptsInCommon) |
|
const SkTCurve & | part () const |
|
int | pointCount () const |
|
const SkDPoint & | pointFirst () const |
|
const SkDPoint & | pointLast () const |
|
bool | removeAllBounded () |
|
bool | removeBounded (const SkTSpan *opp) |
|
void | reset () |
|
void | resetBounds (const SkTCurve &curve) |
|
bool | split (SkTSpan *work, SkArenaAlloc *heap) |
|
bool | splitAt (SkTSpan *work, double t, SkArenaAlloc *heap) |
|
double | startT () const |
|
Definition at line 93 of file SkPathOpsTSect.h.
◆ SkTSpan()
Definition at line 95 of file SkPathOpsTSect.h.
95 {
96 fPart = curve.
make(heap);
97 }
virtual SkTCurve * make(SkArenaAlloc &) const =0
◆ addBounded()
Definition at line 63 of file SkPathOpsTSect.cpp.
63 {
66 bounded->
fNext = fBounded;
67 fBounded = bounded;
68}
auto make(Ctor &&ctor) -> decltype(ctor(nullptr))
◆ closestBoundedT()
double SkTSpan::closestBoundedT |
( |
const SkDPoint & |
pt | ) |
const |
Definition at line 118 of file SkPathOpsTSect.cpp.
118 {
120 double closest = DBL_MAX;
122 while (testBounded) {
124 double startDist =
test->pointFirst().distanceSquared(pt);
125 if (closest > startDist) {
126 closest = startDist;
128 }
129 double endDist =
test->pointLast().distanceSquared(pt);
130 if (closest > endDist) {
131 closest = endDist;
133 }
134 testBounded = testBounded->
fNext;
135 }
138}
bool between(double a, double b, double c)
◆ contains()
bool SkTSpan::contains |
( |
double |
t | ) |
const |
Definition at line 153 of file SkPathOpsTSect.cpp.
153 {
155 do {
156 if (
between(work->fStartT, t, work->fEndT)) {
157 return true;
158 }
159 } while ((work = work->fNext));
160 return false;
161}
◆ debugInit()
Definition at line 103 of file SkPathOpsTSect.h.
103 {
104#ifdef SK_DEBUG
111#endif
112 }
virtual void debugInit()=0
bool initBounds(const SkTCurve &)
void init(const SkTCurve &)
◆ debugOpp()
const SkTSect * SkTSpan::debugOpp |
( |
| ) |
const |
◆ dump()
void SkTSpan::dump |
( |
| ) |
const |
Definition at line 1340 of file PathOpsDebug.cpp.
1340 {
1341 dumpID();
1342 SkDebugf(
"=(%g,%g) [", fStartT, fEndT);
1344 while (testBounded) {
1347 span->dumpID();
1350 }
1352 }
1354}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
const SkTSpan * next() const
◆ dumpAll()
void SkTSpan::dumpAll |
( |
| ) |
const |
Definition at line 1323 of file PathOpsDebug.cpp.
1323 {
1324 dumpID();
1325 SkDebugf(
"=(%g,%g) [", fStartT, fEndT);
1327 while (testBounded) {
1330 span->dumpID();
1331 SkDebugf(
"=(%g,%g)", span->fStartT, span->fEndT);
1334 }
1336 }
1338}
◆ dumpBounded()
void SkTSpan::dumpBounded |
( |
int |
id | ) |
const |
Definition at line 1356 of file PathOpsDebug.cpp.
1356 {
1358}
SkDEBUGCODE(SkOpGlobalState *globalState() const { return fDebugGlobalState;}) bool hasOppT(double t) const
◆ dumpBounds()
void SkTSpan::dumpBounds |
( |
| ) |
const |
Definition at line 1360 of file PathOpsDebug.cpp.
1360 {
1361 dumpID();
1362 SkDebugf(
" bounds=(%1.9g,%1.9g, %1.9g,%1.9g) boundsMax=%1.9g%s\n",
1364 fCollapsed ? " collapsed" : "");
1365}
◆ dumpCoin()
void SkTSpan::dumpCoin |
( |
| ) |
const |
◆ endT()
double SkTSpan::endT |
( |
| ) |
const |
|
inline |
◆ findOppSpan()
Definition at line 167 of file SkPathOpsTSect.cpp.
168 {
170 while (bounded) {
174 }
175 bounded = bounded->
fNext;
176 }
177 return nullptr;
178}
◆ findOppT()
SkTSpan * SkTSpan::findOppT |
( |
double |
t | ) |
const |
|
inline |
◆ hullsIntersect()
int SkTSpan::hullsIntersect |
( |
SkTSpan * |
span, |
|
|
bool * |
start, |
|
|
bool * |
oppStart |
|
) |
| |
Definition at line 212 of file SkPathOpsTSect.cpp.
213 {
215 return 0;
216 }
217 int hullSect = this->hullCheck(opp,
start, oppStart);
218 if (hullSect >= 0) {
219 return hullSect;
220 }
221 hullSect = opp->hullCheck(
this, oppStart,
start);
222 if (hullSect >= 0) {
223 return hullSect;
224 }
225 return -1;
226}
bool intersects(const SkDRect &r) const
◆ init()
void SkTSpan::init |
( |
const SkTCurve & |
c | ) |
|
Definition at line 228 of file SkPathOpsTSect.cpp.
228 {
229 fPrev = fNext = nullptr;
230 fStartT = 0;
231 fEndT = 1;
232 fBounded = nullptr;
234}
void resetBounds(const SkTCurve &curve)
◆ initBounds()
bool SkTSpan::initBounds |
( |
const SkTCurve & |
c | ) |
|
Definition at line 236 of file SkPathOpsTSect.cpp.
236 {
238 return false;
239 }
246 fHasPerp = false;
247 fDeleted = false;
248#if DEBUG_T_SECT
249 if (fCollapsed) {
251 }
252#endif
253 return fBounds.
valid();
254}
static bool SkDoubleIsNaN(double x)
virtual bool collapsed() const =0
virtual void subDivide(double t1, double t2, SkTCurve *curve) const =0
static float max(float r, float g, float b)
void setBounds(const SkDConic &curve)
◆ isBounded()
bool SkTSpan::isBounded |
( |
| ) |
const |
|
inline |
◆ linearsIntersect()
bool SkTSpan::linearsIntersect |
( |
SkTSpan * |
span | ) |
|
Definition at line 256 of file SkPathOpsTSect.cpp.
256 {
257 int result = this->linearIntersects(*span->fPart);
260 }
262 result = span->linearIntersects(*fPart);
263
265}
static constexpr bool SkToBool(const T &x)
◆ linearT()
double SkTSpan::linearT |
( |
const SkDPoint & |
pt | ) |
const |
Definition at line 267 of file SkPathOpsTSect.cpp.
267 {
269 return fabs(
len.fX) > fabs(
len.fY)
271 : (pt.
fY - this->pointFirst().fY) /
len.fY;
272}
const SkDPoint & pointLast() const
const SkDPoint & pointFirst() const
◆ markCoincident()
void SkTSpan::markCoincident |
( |
| ) |
|
|
inline |
◆ next()
const SkTSpan * SkTSpan::next |
( |
| ) |
const |
|
inline |
◆ onlyEndPointsInCommon()
bool SkTSpan::onlyEndPointsInCommon |
( |
const SkTSpan * |
opp, |
|
|
bool * |
start, |
|
|
bool * |
oppStart, |
|
|
bool * |
ptsInCommon |
|
) |
| |
Definition at line 320 of file SkPathOpsTSect.cpp.
321 {
322 if (opp->
pointFirst() == this->pointFirst()) {
323 *
start = *oppStart =
true;
324 }
else if (opp->
pointFirst() == this->pointLast()) {
326 *oppStart = true;
327 }
else if (opp->
pointLast() == this->pointFirst()) {
329 *oppStart = false;
330 }
else if (opp->
pointLast() == this->pointLast()) {
331 *
start = *oppStart =
false;
332 } else {
333 *ptsInCommon = false;
334 return false;
335 }
336 *ptsInCommon = true;
337 const SkDPoint* otherPts[4], * oppOtherPts[4];
338
340 fPart->
otherPts(baseIndex, otherPts);
343 for (
int o1 = 0; o1 < this->
pointCount() - 1; ++o1) {
345 for (
int o2 = 0; o2 < opp->
pointCount() - 1; ++o2) {
347 if (
v2.dot(v1) >= 0) {
348 return false;
349 }
350 }
351 }
352 return true;
353}
virtual void otherPts(int oddMan, const SkDPoint *endPt[2]) const =0
virtual int pointLast() const =0
◆ part()
const SkTCurve & SkTSpan::part |
( |
| ) |
const |
|
inline |
◆ pointCount()
int SkTSpan::pointCount |
( |
| ) |
const |
|
inline |
◆ pointFirst()
const SkDPoint & SkTSpan::pointFirst |
( |
| ) |
const |
|
inline |
◆ pointLast()
const SkDPoint & SkTSpan::pointLast |
( |
| ) |
const |
|
inline |
◆ removeAllBounded()
bool SkTSpan::removeAllBounded |
( |
| ) |
|
Definition at line 367 of file SkPathOpsTSect.cpp.
367 {
368 bool deleteSpan = false;
370 while (bounded) {
373 bounded = bounded->
fNext;
374 }
375 return deleteSpan;
376}
bool removeBounded(const SkTSpan *opp)
◆ removeBounded()
bool SkTSpan::removeBounded |
( |
const SkTSpan * |
opp | ) |
|
Definition at line 378 of file SkPathOpsTSect.cpp.
378 {
379 if (fHasPerp) {
380 bool foundStart = false;
381 bool foundEnd = false;
383 while (bounded) {
388 }
389 bounded = bounded->
fNext;
390 }
391 if (!foundStart || !foundEnd) {
392 fHasPerp = false;
395 }
396 }
399 while (bounded) {
403 prev->fNext = boundedNext;
404 return false;
405 } else {
406 fBounded = boundedNext;
407 return fBounded == nullptr;
408 }
409 }
411 bounded = boundedNext;
412 }
414 return false;
415}
static float prev(float f)
◆ reset()
◆ resetBounds()
void SkTSpan::resetBounds |
( |
const SkTCurve & |
curve | ) |
|
|
inline |
◆ SkDEBUGCODE()
SkTSpan::SkDEBUGCODE |
( |
SkOpGlobalState *globalState() const { return fDebugGlobalState;} |
| ) |
const |
|
inline |
Definition at line 143 of file SkPathOpsTSect.h.
143 { return fDebugGlobalState; })
144
145 bool hasOppT(double t) const {
147 }
◆ split()
Definition at line 200 of file SkPathOpsTSect.h.
200 {
201 return splitAt(work, (work->fStartT + work->fEndT) * 0.5, heap);
202 }
bool splitAt(SkTSpan *work, double t, SkArenaAlloc *heap)
◆ splitAt()
Definition at line 417 of file SkPathOpsTSect.cpp.
417 {
418 fStartT = t;
419 fEndT = work->fEndT;
420 if (fStartT == fEndT) {
421 fCollapsed = true;
422 return false;
423 }
424 work->fEndT = t;
425 if (work->fStartT == work->fEndT) {
426 work->fCollapsed = true;
427 return false;
428 }
429 fPrev = work;
430 fNext = work->fNext;
431 fIsLinear = work->fIsLinear;
432 fIsLine = work->fIsLine;
433
434 work->fNext = this;
435 if (fNext) {
436 fNext->fPrev = this;
437 }
438 this->validate();
440 fBounded = nullptr;
441 while (bounded) {
443 bounded = bounded->
fNext;
444 }
445 bounded = fBounded;
446 while (bounded) {
448 bounded = bounded->
fNext;
449 }
450 return true;
451}
void addBounded(SkTSpan *, SkArenaAlloc *)
◆ startT()
double SkTSpan::startT |
( |
| ) |
const |
|
inline |
◆ SkTSect
The documentation for this class was generated from the following files: