Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | List of all members
GrAATriangulator::Event Struct Reference

#include <GrAATriangulator.h>

Public Member Functions

 Event (SSEdge *edge, const SkPoint &point, uint8_t alpha)
 
void apply (VertexList *mesh, const Comparator &, EventList *events, GrAATriangulator *)
 

Public Attributes

SSEdgefEdge
 
SkPoint fPoint
 
uint8_t fAlpha
 

Detailed Description

Definition at line 46 of file GrAATriangulator.h.

Constructor & Destructor Documentation

◆ Event()

GrAATriangulator::Event::Event ( SSEdge edge,
const SkPoint point,
uint8_t  alpha 
)
inline

Definition at line 47 of file GrAATriangulator.h.

48 : fEdge(edge), fPoint(point), fAlpha(alpha) {}

Member Function Documentation

◆ apply()

void GrAATriangulator::Event::apply ( VertexList mesh,
const Comparator c,
EventList events,
GrAATriangulator triangulator 
)

Definition at line 253 of file GrAATriangulator.cpp.

254 {
255 if (!fEdge) {
256 return;
257 }
260 SSEdge* prevEdge = fEdge->fPrev->fPrev;
261 SSEdge* nextEdge = fEdge->fNext->fNext;
262 if (!prevEdge || !nextEdge || !prevEdge->fEdge || !nextEdge->fEdge) {
263 return;
264 }
265 Vertex* dest = triangulator->makeSortedVertex(fPoint, fAlpha, mesh, prev, c);
266 dest->fSynthetic = true;
267 SSVertex* ssv = triangulator->fAlloc->make<SSVertex>(dest);
268 TESS_LOG("collapsing %g, %g (original edge %g -> %g) to %g (%g, %g) alpha %d\n",
269 prev->fID, next->fID, fEdge->fEdge->fTop->fID, fEdge->fEdge->fBottom->fID, dest->fID,
271 fEdge->fEdge = nullptr;
272
273 triangulator->connectSSEdge(prev, dest, c);
274 triangulator->connectSSEdge(next, dest, c);
275
276 prevEdge->fNext = nextEdge->fPrev = ssv;
277 ssv->fPrev = prevEdge;
278 ssv->fNext = nextEdge;
279 if (!prevEdge->fEdge || !nextEdge->fEdge) {
280 return;
281 }
282 if (prevEdge->fEvent) {
283 prevEdge->fEvent->fEdge = nullptr;
284 }
285 if (nextEdge->fEvent) {
286 nextEdge->fEvent->fEdge = nullptr;
287 }
288 if (prevEdge->fPrev == nextEdge->fNext) {
289 triangulator->connectSSEdge(prevEdge->fPrev->fVertex, dest, c);
290 prevEdge->fEdge = nextEdge->fEdge = nullptr;
291 } else {
292 triangulator->computeBisector(prevEdge->fEdge, nextEdge->fEdge, dest);
293 SkASSERT(prevEdge != fEdge && nextEdge != fEdge);
294 if (dest->fPartner) {
295 triangulator->makeEvent(prevEdge, events);
296 triangulator->makeEvent(nextEdge, events);
297 } else {
298 triangulator->makeEvent(prevEdge, prevEdge->fPrev->fVertex, nextEdge, dest, events, c);
299 triangulator->makeEvent(nextEdge, nextEdge->fNext->fVertex, prevEdge, dest, events, c);
300 }
301 }
302}
#define TESS_LOG(...)
static float next(float f)
static float prev(float f)
#define SkASSERT(cond)
Definition: SkAssert.h:116
SkMesh mesh
Definition: SkRecords.h:345
dest
Definition: zip.py:79
Vertex * fVertex
SSEdge * fPrev
SSEdge * fNext
float fX
x-axis value
Definition: SkPoint_impl.h:164
float fY
y-axis value
Definition: SkPoint_impl.h:165

Member Data Documentation

◆ fAlpha

uint8_t GrAATriangulator::Event::fAlpha

Definition at line 51 of file GrAATriangulator.h.

◆ fEdge

SSEdge* GrAATriangulator::Event::fEdge

Definition at line 49 of file GrAATriangulator.h.

◆ fPoint

SkPoint GrAATriangulator::Event::fPoint

Definition at line 50 of file GrAATriangulator.h.


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