Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SkCoincidentSpans Class Reference

#include <SkOpCoincidence.h>

Public Member Functions

const SkOpPtTcoinPtTEnd () const
 
const SkOpPtTcoinPtTStart () const
 
SkOpPtTcoinPtTEndWritable () const
 
SkOpPtTcoinPtTStartWritable () const
 
bool collapsed (const SkOpPtT *) const
 
bool contains (const SkOpPtT *s, const SkOpPtT *e) const
 
void correctEnds ()
 
void correctOneEnd (const SkOpPtT *(SkCoincidentSpans::*getEnd)() const, void(SkCoincidentSpans::*setEnd)(const SkOpPtT *ptT))
 
const char * debugID () const
 
void debugShow () const
 
void dump () const
 
bool expand ()
 
bool extend (const SkOpPtT *coinPtTStart, const SkOpPtT *coinPtTEnd, const SkOpPtT *oppPtTStart, const SkOpPtT *oppPtTEnd)
 
bool flipped () const
 
 SkDEBUGCODE (SkOpGlobalState *globalState() { return fGlobalState;}) void init(SkDEBUGCODE(SkOpGlobalState *globalState))
 
SkCoincidentSpansnext ()
 
const SkCoincidentSpansnext () const
 
SkCoincidentSpans ** nextPtr ()
 
const SkOpPtToppPtTStart () const
 
const SkOpPtToppPtTEnd () const
 
SkOpPtToppPtTStartWritable () const
 
SkOpPtToppPtTEndWritable () const
 
bool ordered (bool *result) const
 
void set (SkCoincidentSpans *next, const SkOpPtT *coinPtTStart, const SkOpPtT *coinPtTEnd, const SkOpPtT *oppPtTStart, const SkOpPtT *oppPtTEnd)
 
void setCoinPtTEnd (const SkOpPtT *ptT)
 
void setCoinPtTStart (const SkOpPtT *ptT)
 
void setEnds (const SkOpPtT *coinPtTEnd, const SkOpPtT *oppPtTEnd)
 
void setOppPtTEnd (const SkOpPtT *ptT)
 
void setOppPtTStart (const SkOpPtT *ptT)
 
void setStarts (const SkOpPtT *coinPtTStart, const SkOpPtT *oppPtTStart)
 
void setNext (SkCoincidentSpans *next)
 

Detailed Description

Definition at line 22 of file SkOpCoincidence.h.

Member Function Documentation

◆ coinPtTEnd()

const SkOpPtT * SkCoincidentSpans::coinPtTEnd ( ) const

Definition at line 30 of file SkOpCoincidence.cpp.

30 {
31 return fCoinPtTEnd;
32}

◆ coinPtTEndWritable()

SkOpPtT * SkCoincidentSpans::coinPtTEndWritable ( ) const
inline

Definition at line 29 of file SkOpCoincidence.h.

29{ return const_cast<SkOpPtT*>(fCoinPtTEnd); }

◆ coinPtTStart()

const SkOpPtT * SkCoincidentSpans::coinPtTStart ( ) const

Definition at line 35 of file SkOpCoincidence.cpp.

35 {
36 return fCoinPtTStart;
37}

◆ coinPtTStartWritable()

SkOpPtT * SkCoincidentSpans::coinPtTStartWritable ( ) const
inline

Definition at line 30 of file SkOpCoincidence.h.

30{ return const_cast<SkOpPtT*>(fCoinPtTStart); }

◆ collapsed()

bool SkCoincidentSpans::collapsed ( const SkOpPtT test) const

Definition at line 22 of file SkOpCoincidence.cpp.

22 {
23 return (fCoinPtTStart == test && fCoinPtTEnd->contains(test))
24 || (fCoinPtTEnd == test && fCoinPtTStart->contains(test))
25 || (fOppPtTStart == test && fOppPtTEnd->contains(test))
26 || (fOppPtTEnd == test && fOppPtTStart->contains(test));
27}
bool contains(const SkOpPtT *) const
Definition SkOpSpan.cpp:36

◆ contains()

bool SkCoincidentSpans::contains ( const SkOpPtT s,
const SkOpPtT e 
) const

Definition at line 131 of file SkOpCoincidence.cpp.

131 {
132 if (s->fT > e->fT) {
133 using std::swap;
134 swap(s, e);
135 }
136 if (s->segment() == fCoinPtTStart->segment()) {
137 return fCoinPtTStart->fT <= s->fT && e->fT <= fCoinPtTEnd->fT;
138 } else {
139 SkASSERT(s->segment() == fOppPtTStart->segment());
140 double oppTs = fOppPtTStart->fT;
141 double oppTe = fOppPtTEnd->fT;
142 if (oppTs > oppTe) {
143 using std::swap;
144 swap(oppTs, oppTe);
145 }
146 return oppTs <= s->fT && e->fT <= oppTe;
147 }
148}
#define SkASSERT(cond)
Definition SkAssert.h:116
void swap(sk_sp< T > &a, sk_sp< T > &b)
Definition SkRefCnt.h:341
double fT
Definition SkOpSpan.h:166
const SkOpSegment * segment() const
Definition SkOpSpan.cpp:144
struct MyStruct s

◆ correctEnds()

void SkCoincidentSpans::correctEnds ( )

Definition at line 57 of file SkOpCoincidence.cpp.

57 {
62}
const SkOpPtT * oppPtTEnd() const
void setOppPtTEnd(const SkOpPtT *ptT)
void setCoinPtTStart(const SkOpPtT *ptT)
const SkOpPtT * coinPtTEnd() const
const SkOpPtT * coinPtTStart() const
void correctOneEnd(const SkOpPtT *(SkCoincidentSpans::*getEnd)() const, void(SkCoincidentSpans::*setEnd)(const SkOpPtT *ptT))
void setCoinPtTEnd(const SkOpPtT *ptT)
void setOppPtTStart(const SkOpPtT *ptT)
const SkOpPtT * oppPtTStart() const

◆ correctOneEnd()

void SkCoincidentSpans::correctOneEnd ( const SkOpPtT *(SkCoincidentSpans::*)() const  getEnd,
void(SkCoincidentSpans::*)(const SkOpPtT *ptT)  setEnd 
)

Definition at line 40 of file SkOpCoincidence.cpp.

42 {
43 const SkOpPtT* origPtT = (this->*getEnd)();
44 const SkOpSpanBase* origSpan = origPtT->span();
45 const SkOpSpan* prev = origSpan->prev();
46 const SkOpPtT* testPtT = prev ? prev->next()->ptT()
47 : origSpan->upCast()->next()->prev()->ptT();
48 if (origPtT != testPtT) {
49 (this->*setEnd)(testPtT);
50 }
51}
static float prev(float f)
const SkOpSpanBase * span() const
Definition SkOpSpan.h:154
const SkOpPtT * next() const
Definition SkOpSpan.h:93
const SkOpSpan * prev() const
Definition SkOpSpan.h:298
SkOpSpan * upCast()
Definition SkOpSpan.h:383
const SkOpPtT * ptT() const
Definition SkOpSpan.h:310
SkOpSpanBase * next() const
Definition SkOpSpan.h:495

◆ debugID()

const char * SkCoincidentSpans::debugID ( ) const
inline

Definition at line 46 of file SkOpCoincidence.h.

46 {
47#if DEBUG_COIN
48 return fGlobalState->debugCoinDictEntry().fFunctionName;
49#else
50 return nullptr;
51#endif
52 }

◆ debugShow()

void SkCoincidentSpans::debugShow ( ) const

Definition at line 2083 of file SkPathOpsDebug.cpp.

2083 {
2084 SkDebugf("coinSpan - id=%d t=%1.9g tEnd=%1.9g\n", coinPtTStart()->segment()->debugID(),
2085 coinPtTStart()->fT, coinPtTEnd()->fT);
2086 SkDebugf("coinSpan + id=%d t=%1.9g tEnd=%1.9g\n", oppPtTStart()->segment()->debugID(),
2087 oppPtTStart()->fT, oppPtTEnd()->fT);
2088}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
const char * debugID() const

◆ dump()

void SkCoincidentSpans::dump ( ) const

Definition at line 924 of file PathOpsDebug.cpp.

924 {
925 SkDebugf("- seg=%d span=%d ptT=%d ", fCoinPtTStart->segment()->debugID(),
926 fCoinPtTStart->span()->debugID(), fCoinPtTStart->debugID());
927 fCoinPtTStart->dumpBase();
928 SkDebugf(" span=%d ptT=%d ", fCoinPtTEnd->span()->debugID(), fCoinPtTEnd->debugID());
929 fCoinPtTEnd->dumpBase();
930 if (fCoinPtTStart->segment()->operand()) {
931 SkDebugf(" operand");
932 }
933 if (fCoinPtTStart->segment()->isXor()) {
934 SkDebugf(" xor");
935 }
936 SkDebugf("\n");
937 SkDebugf("+ seg=%d span=%d ptT=%d ", fOppPtTStart->segment()->debugID(),
938 fOppPtTStart->span()->debugID(), fOppPtTStart->debugID());
939 fOppPtTStart->dumpBase();
940 SkDebugf(" span=%d ptT=%d ", fOppPtTEnd->span()->debugID(), fOppPtTEnd->debugID());
941 fOppPtTEnd->dumpBase();
942 if (fOppPtTStart->segment()->operand()) {
943 SkDebugf(" operand");
944 }
945 if (fOppPtTStart->segment()->isXor()) {
946 SkDebugf(" xor");
947 }
948 SkDebugf("\n");
949}
int debugID() const
Definition SkOpSpan.h:50
void dumpBase() const
bool operand() const
int debugID() const
bool isXor() const
int debugID() const
Definition SkOpSpan.h:224

◆ expand()

bool SkCoincidentSpans::expand ( )

Definition at line 66 of file SkOpCoincidence.cpp.

66 {
67 bool expanded = false;
68 const SkOpSegment* segment = coinPtTStart()->segment();
69 const SkOpSegment* oppSegment = oppPtTStart()->segment();
70 do {
71 const SkOpSpan* start = coinPtTStart()->span()->upCast();
72 const SkOpSpan* prev = start->prev();
73 const SkOpPtT* oppPtT;
74 if (!prev || !(oppPtT = prev->contains(oppSegment))) {
75 break;
76 }
77 double midT = (prev->t() + start->t()) / 2;
78 if (!segment->isClose(midT, oppSegment)) {
79 break;
80 }
81 setStarts(prev->ptT(), oppPtT);
82 expanded = true;
83 } while (true);
84 do {
85 const SkOpSpanBase* end = coinPtTEnd()->span();
86 SkOpSpanBase* next = end->final() ? nullptr : end->upCast()->next();
87 if (next && next->deleted()) {
88 break;
89 }
90 const SkOpPtT* oppPtT;
91 if (!next || !(oppPtT = next->contains(oppSegment))) {
92 break;
93 }
94 double midT = (end->t() + next->t()) / 2;
95 if (!segment->isClose(midT, oppSegment)) {
96 break;
97 }
98 setEnds(next->ptT(), oppPtT);
99 expanded = true;
100 } while (true);
101 return expanded;
102}
bool contains(const SkOpPtT *s, const SkOpPtT *e) const
SkCoincidentSpans * next()
void setStarts(const SkOpPtT *coinPtTStart, const SkOpPtT *oppPtTStart)
void setEnds(const SkOpPtT *coinPtTEnd, const SkOpPtT *oppPtTEnd)
bool isClose(double t, const SkOpSegment *opp) const
glong glong end

◆ extend()

bool SkCoincidentSpans::extend ( const SkOpPtT coinPtTStart,
const SkOpPtT coinPtTEnd,
const SkOpPtT oppPtTStart,
const SkOpPtT oppPtTEnd 
)

Definition at line 105 of file SkOpCoincidence.cpp.

106 {
107 bool result = false;
108 if (fCoinPtTStart->fT > coinPtTStart->fT || (this->flipped()
109 ? fOppPtTStart->fT < oppPtTStart->fT : fOppPtTStart->fT > oppPtTStart->fT)) {
110 this->setStarts(coinPtTStart, oppPtTStart);
111 result = true;
112 }
113 if (fCoinPtTEnd->fT < coinPtTEnd->fT || (this->flipped()
114 ? fOppPtTEnd->fT > oppPtTEnd->fT : fOppPtTEnd->fT < oppPtTEnd->fT)) {
115 this->setEnds(coinPtTEnd, oppPtTEnd);
116 result = true;
117 }
118 return result;
119}
GAsyncResult * result

◆ flipped()

bool SkCoincidentSpans::flipped ( ) const
inline

Definition at line 63 of file SkOpCoincidence.h.

63{ return fOppPtTStart->fT > fOppPtTEnd->fT; }

◆ next() [1/2]

SkCoincidentSpans * SkCoincidentSpans::next ( )
inline

Definition at line 71 of file SkOpCoincidence.h.

71{ return fNext; }

◆ next() [2/2]

const SkCoincidentSpans * SkCoincidentSpans::next ( ) const
inline

Definition at line 72 of file SkOpCoincidence.h.

72{ return fNext; }

◆ nextPtr()

SkCoincidentSpans ** SkCoincidentSpans::nextPtr ( )
inline

Definition at line 73 of file SkOpCoincidence.h.

73{ return &fNext; }

◆ oppPtTEnd()

const SkOpPtT * SkCoincidentSpans::oppPtTEnd ( ) const

Definition at line 156 of file SkOpCoincidence.cpp.

156 {
157 return fOppPtTEnd;
158}

◆ oppPtTEndWritable()

SkOpPtT * SkCoincidentSpans::oppPtTEndWritable ( ) const
inline

Definition at line 79 of file SkOpCoincidence.h.

79{ return const_cast<SkOpPtT*>(fOppPtTEnd); }

◆ oppPtTStart()

const SkOpPtT * SkCoincidentSpans::oppPtTStart ( ) const

Definition at line 151 of file SkOpCoincidence.cpp.

151 {
152 return fOppPtTStart;
153}

◆ oppPtTStartWritable()

SkOpPtT * SkCoincidentSpans::oppPtTStartWritable ( ) const
inline

Definition at line 78 of file SkOpCoincidence.h.

78{ return const_cast<SkOpPtT*>(fOppPtTStart); }

◆ ordered()

bool SkCoincidentSpans::ordered ( bool *  result) const

Definition at line 163 of file SkOpCoincidence.cpp.

163 {
164 const SkOpSpanBase* start = this->coinPtTStart()->span();
165 const SkOpSpanBase* end = this->coinPtTEnd()->span();
166 const SkOpSpanBase* next = start->upCast()->next();
167 if (next == end) {
168 *result = true;
169 return true;
170 }
171 bool flipped = this->flipped();
172 const SkOpSegment* oppSeg = this->oppPtTStart()->segment();
173 double oppLastT = fOppPtTStart->fT;
174 do {
175 const SkOpPtT* opp = next->contains(oppSeg);
176 if (!opp) {
177// SkOPOBJASSERT(start, 0); // may assert if coincident span isn't fully processed
178 return false;
179 }
180 if ((oppLastT > opp->fT) != flipped) {
181 *result = false;
182 return true;
183 }
184 oppLastT = opp->fT;
185 if (next == end) {
186 break;
187 }
188 if (!next->upCastable()) {
189 *result = false;
190 return true;
191 }
192 next = next->upCast()->next();
193 } while (true);
194 *result = true;
195 return true;
196}
bool flipped() const

◆ set()

void SkCoincidentSpans::set ( SkCoincidentSpans next,
const SkOpPtT coinPtTStart,
const SkOpPtT coinPtTEnd,
const SkOpPtT oppPtTStart,
const SkOpPtT oppPtTEnd 
)

Definition at line 122 of file SkOpCoincidence.cpp.

123 {
125 fNext = next;
126 this->setStarts(coinPtTStart, oppPtTStart);
127 this->setEnds(coinPtTEnd, oppPtTEnd);
128}
static bool Ordered(const SkOpPtT *coinPtTStart, const SkOpPtT *oppPtTStart)

◆ setCoinPtTEnd()

void SkCoincidentSpans::setCoinPtTEnd ( const SkOpPtT ptT)
inline

Definition at line 85 of file SkOpCoincidence.h.

85 {
86 SkOPASSERT(ptT == ptT->span()->ptT());
87 SkOPASSERT(!fCoinPtTStart || ptT->fT != fCoinPtTStart->fT);
88 SkASSERT(!fCoinPtTStart || fCoinPtTStart->segment() == ptT->segment());
89 fCoinPtTEnd = ptT;
90 ptT->setCoincident();
91 }
#define SkOPASSERT(cond)
void setCoincident() const
Definition SkOpSpan.h:143

◆ setCoinPtTStart()

void SkCoincidentSpans::setCoinPtTStart ( const SkOpPtT ptT)
inline

Definition at line 93 of file SkOpCoincidence.h.

93 {
94 SkOPASSERT(ptT == ptT->span()->ptT());
95 SkOPASSERT(!fCoinPtTEnd || ptT->fT != fCoinPtTEnd->fT);
96 SkASSERT(!fCoinPtTEnd || fCoinPtTEnd->segment() == ptT->segment());
97 fCoinPtTStart = ptT;
98 ptT->setCoincident();
99 }

◆ setEnds()

void SkCoincidentSpans::setEnds ( const SkOpPtT coinPtTEnd,
const SkOpPtT oppPtTEnd 
)
inline

Definition at line 101 of file SkOpCoincidence.h.

101 {
102 this->setCoinPtTEnd(coinPtTEnd);
103 this->setOppPtTEnd(oppPtTEnd);
104 }

◆ setNext()

void SkCoincidentSpans::setNext ( SkCoincidentSpans next)
inline

Definition at line 127 of file SkOpCoincidence.h.

127{ fNext = next; }

◆ setOppPtTEnd()

void SkCoincidentSpans::setOppPtTEnd ( const SkOpPtT ptT)
inline

Definition at line 106 of file SkOpCoincidence.h.

106 {
107 SkOPASSERT(ptT == ptT->span()->ptT());
108 SkOPASSERT(!fOppPtTStart || ptT->fT != fOppPtTStart->fT);
109 SkASSERT(!fOppPtTStart || fOppPtTStart->segment() == ptT->segment());
110 fOppPtTEnd = ptT;
111 ptT->setCoincident();
112 }

◆ setOppPtTStart()

void SkCoincidentSpans::setOppPtTStart ( const SkOpPtT ptT)
inline

Definition at line 114 of file SkOpCoincidence.h.

114 {
115 SkOPASSERT(ptT == ptT->span()->ptT());
116 SkOPASSERT(!fOppPtTEnd || ptT->fT != fOppPtTEnd->fT);
117 SkASSERT(!fOppPtTEnd || fOppPtTEnd->segment() == ptT->segment());
118 fOppPtTStart = ptT;
119 ptT->setCoincident();
120 }

◆ setStarts()

void SkCoincidentSpans::setStarts ( const SkOpPtT coinPtTStart,
const SkOpPtT oppPtTStart 
)
inline

Definition at line 122 of file SkOpCoincidence.h.

122 {
123 this->setCoinPtTStart(coinPtTStart);
124 this->setOppPtTStart(oppPtTStart);
125 }

◆ SkDEBUGCODE()

SkCoincidentSpans::SkDEBUGCODE ( SkOpGlobalState *globalState() { return fGlobalState;}  )
inline

Definition at line 64 of file SkOpCoincidence.h.

64 { return fGlobalState; })
65
66 void init(SkDEBUGCODE(SkOpGlobalState* globalState)) {
67 sk_bzero(this, sizeof(*this));
68 SkDEBUGCODE(fGlobalState = globalState);
69 }
#define SkDEBUGCODE(...)
Definition SkDebug.h:23
static void sk_bzero(void *buffer, size_t size)
Definition SkMalloc.h:105
init(device_serial, adb_binary)
Definition _adb_path.py:12

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