Flutter Engine
The Flutter Engine
Classes | Macros | Typedefs | Functions | Variables
GrAATriangulator.cpp File Reference
#include "src/gpu/ganesh/geometry/GrAATriangulator.h"
#include "include/core/SkPathTypes.h"
#include "include/private/base/SkDebug.h"
#include "include/private/base/SkMath.h"
#include "src/gpu/BufferWriter.h"
#include "src/gpu/ganesh/GrEagerVertexAllocator.h"
#include <cstddef>
#include <queue>
#include <unordered_map>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

struct  SSVertex
 
struct  GrAATriangulator::SSEdge
 
struct  GrAATriangulator::EventList
 

Macros

#define TESS_LOG(...)
 
#define DUMP_MESH(MESH)
 

Typedefs

using EdgeType = GrTriangulator::EdgeType
 
using Vertex = GrTriangulator::Vertex
 
using VertexList = GrTriangulator::VertexList
 
using Line = GrTriangulator::Line
 
using Edge = GrTriangulator::Edge
 
using EdgeList = GrTriangulator::EdgeList
 
using Poly = GrTriangulator::Poly
 
using Comparator = GrTriangulator::Comparator
 
using SSEdge = GrAATriangulator::SSEdge
 
using EventList = GrAATriangulator::EventList
 
using Event = GrAATriangulator::Event
 
using EventComparator = GrAATriangulator::EventComparator
 
typedef std::unordered_map< Vertex *, SSVertex * > SSVertexMap
 
typedef std::vector< SSEdge * > SSEdgeList
 
typedef std::priority_queue< Event *, std::vector< Event * >, EventComparatorEventPQ
 

Functions

static void dump_skel (const SSEdgeList &ssEdges)
 
static void get_edge_normal (const Edge *e, SkVector *normal)
 
static bool is_overlap_edge (Edge *e)
 
static bool inversion (Vertex *prev, Vertex *next, Edge *origEdge, const Comparator &c)
 

Variables

static constexpr float kCosMiterAngle = 0.97f
 

Macro Definition Documentation

◆ DUMP_MESH

#define DUMP_MESH (   MESH)

Definition at line 28 of file GrAATriangulator.cpp.

◆ TESS_LOG

#define TESS_LOG (   ...)

Definition at line 27 of file GrAATriangulator.cpp.

Typedef Documentation

◆ Comparator

Definition at line 40 of file GrAATriangulator.cpp.

◆ Edge

Definition at line 37 of file GrAATriangulator.cpp.

◆ EdgeList

Definition at line 38 of file GrAATriangulator.cpp.

◆ EdgeType

Definition at line 33 of file GrAATriangulator.cpp.

◆ Event

Definition at line 43 of file GrAATriangulator.cpp.

◆ EventComparator

Definition at line 44 of file GrAATriangulator.cpp.

◆ EventList

Definition at line 42 of file GrAATriangulator.cpp.

◆ EventPQ

typedef std::priority_queue<Event*, std::vector<Event*>, EventComparator> EventPQ

Definition at line 65 of file GrAATriangulator.cpp.

◆ Line

Definition at line 36 of file GrAATriangulator.cpp.

◆ Poly

Definition at line 39 of file GrAATriangulator.cpp.

◆ SSEdge

Definition at line 41 of file GrAATriangulator.cpp.

◆ SSEdgeList

typedef std::vector<SSEdge*> SSEdgeList

Definition at line 64 of file GrAATriangulator.cpp.

◆ SSVertexMap

typedef std::unordered_map<Vertex*, SSVertex*> SSVertexMap

Definition at line 63 of file GrAATriangulator.cpp.

◆ Vertex

Definition at line 34 of file GrAATriangulator.cpp.

◆ VertexList

Definition at line 35 of file GrAATriangulator.cpp.

Function Documentation

◆ dump_skel()

static void dump_skel ( const SSEdgeList ssEdges)
static

Definition at line 131 of file GrAATriangulator.cpp.

131 {
132#if TRIANGULATOR_LOGGING
133 for (SSEdge* edge : ssEdges) {
134 if (edge->fEdge) {
135 TESS_LOG("skel edge %g -> %g",
136 edge->fPrev->fVertex->fID,
137 edge->fNext->fVertex->fID);
138 if (edge->fEdge->fTop && edge->fEdge->fBottom) {
139 TESS_LOG(" (original %g -> %g)\n",
140 edge->fEdge->fTop->fID,
141 edge->fEdge->fBottom->fID);
142 } else {
143 TESS_LOG("\n");
144 }
145 }
146 }
147#endif
148}
#define TESS_LOG(...)

◆ get_edge_normal()

static void get_edge_normal ( const Edge e,
SkVector normal 
)
static

Definition at line 183 of file GrAATriangulator.cpp.

183 {
184 normal->set(SkDoubleToScalar(e->fLine.fA),
185 SkDoubleToScalar(e->fLine.fB));
186}
#define SkDoubleToScalar(x)
Definition: SkScalar.h:64

◆ inversion()

static bool inversion ( Vertex prev,
Vertex next,
Edge origEdge,
const Comparator c 
)
static

Definition at line 406 of file GrAATriangulator.cpp.

406 {
407 if (!prev || !next) {
408 return true;
409 }
410 int winding = c.sweep_lt(prev->fPoint, next->fPoint) ? 1 : -1;
411 return winding != origEdge->fWinding;
412}
static float next(float f)
static float prev(float f)
bool sweep_lt(const SkPoint &a, const SkPoint &b) const

◆ is_overlap_edge()

static bool is_overlap_edge ( Edge e)
static

Definition at line 304 of file GrAATriangulator.cpp.

304 {
305 if (e->fType == EdgeType::kOuter) {
306 return e->fWinding != 0 && e->fWinding != 1;
307 } else if (e->fType == EdgeType::kInner) {
308 return e->fWinding != 0 && e->fWinding != -2;
309 } else {
310 return false;
311 }
312}

Variable Documentation

◆ kCosMiterAngle

constexpr float kCosMiterAngle = 0.97f
staticconstexpr

Definition at line 31 of file GrAATriangulator.cpp.