Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
skgpu::graphite::Geometry Class Reference

#include <Geometry.h>

Public Types

enum class  Type : uint8_t {
  kEmpty , kShape , kVertices , kSubRun ,
  kEdgeAAQuad , kCoverageMaskShape , kAnalyticBlur
}
 

Public Member Functions

 Geometry ()
 
 Geometry (Geometry &&geom)
 
 Geometry (const Geometry &geom)
 
 Geometry (const Shape &shape)
 
 Geometry (const SubRunData &subrun)
 
 Geometry (sk_sp< SkVertices > vertices)
 
 Geometry (const EdgeAAQuad &edgeAAQuad)
 
 Geometry (const CoverageMaskShape &mask)
 
 Geometry (const AnalyticBlurMask &blur)
 
 ~Geometry ()
 
Geometryoperator= (Geometry &&geom)
 
Geometryoperator= (const Geometry &geom)
 
Type type () const
 
bool isShape () const
 
bool isVertices () const
 
bool isSubRun () const
 
bool isEdgeAAQuad () const
 
bool isCoverageMaskShape () const
 
bool isAnalyticBlur () const
 
bool isEmpty () const
 
const Shapeshape () const
 
const SubRunDatasubRunData () const
 
const EdgeAAQuadedgeAAQuad () const
 
const CoverageMaskShapecoverageMaskShape () const
 
const AnalyticBlurMaskanalyticBlurMask () const
 
const SkVerticesvertices () const
 
sk_sp< SkVerticesrefVertices () const
 
void setShape (const Shape &shape)
 
void setSubRun (const SubRunData &subRun)
 
void setVertices (sk_sp< SkVertices > vertices)
 
void setEdgeAAQuad (const EdgeAAQuad &edgeAAQuad)
 
void setCoverageMaskShape (const CoverageMaskShape &maskShape)
 
void setAnalyticBlur (const AnalyticBlurMask &blur)
 
Rect bounds () const
 

Detailed Description

Geometry is a container that can house Shapes, SkVertices, text SubRuns, and per-edge AA quads. TODO - Add unit tests for Geometry.

Definition at line 26 of file Geometry.h.

Member Enumeration Documentation

◆ Type

enum class skgpu::graphite::Geometry::Type : uint8_t
strong
Enumerator
kEmpty 
kShape 
kVertices 
kSubRun 
kEdgeAAQuad 
kCoverageMaskShape 
kAnalyticBlur 

Definition at line 28 of file Geometry.h.

Constructor & Destructor Documentation

◆ Geometry() [1/9]

skgpu::graphite::Geometry::Geometry ( )
inline

Definition at line 32 of file Geometry.h.

32{}

◆ Geometry() [2/9]

skgpu::graphite::Geometry::Geometry ( Geometry &&  geom)
inline

Definition at line 33 of file Geometry.h.

33{ *this = std::move(geom); }

◆ Geometry() [3/9]

skgpu::graphite::Geometry::Geometry ( const Geometry geom)
inline

Definition at line 34 of file Geometry.h.

34{ *this = geom; }

◆ Geometry() [4/9]

skgpu::graphite::Geometry::Geometry ( const Shape shape)
inlineexplicit

Definition at line 36 of file Geometry.h.

36{ this->setShape(shape); }
const Shape & shape() const
Definition Geometry.h:106
void setShape(const Shape &shape)
Definition Geometry.h:121

◆ Geometry() [5/9]

skgpu::graphite::Geometry::Geometry ( const SubRunData subrun)
inlineexplicit

Definition at line 37 of file Geometry.h.

37{ this->setSubRun(subrun); }
void setSubRun(const SubRunData &subRun)
Definition Geometry.h:129

◆ Geometry() [6/9]

skgpu::graphite::Geometry::Geometry ( sk_sp< SkVertices vertices)
inlineexplicit

Definition at line 38 of file Geometry.h.

38{ this->setVertices(std::move(vertices)); }
const SkVertices * vertices() const
Definition Geometry.h:115
void setVertices(sk_sp< SkVertices > vertices)
Definition Geometry.h:137

◆ Geometry() [7/9]

skgpu::graphite::Geometry::Geometry ( const EdgeAAQuad edgeAAQuad)
inlineexplicit

Definition at line 39 of file Geometry.h.

39{ this->setEdgeAAQuad(edgeAAQuad); }
const EdgeAAQuad & edgeAAQuad() const
Definition Geometry.h:108
void setEdgeAAQuad(const EdgeAAQuad &edgeAAQuad)
Definition Geometry.h:146

◆ Geometry() [8/9]

skgpu::graphite::Geometry::Geometry ( const CoverageMaskShape mask)
inlineexplicit

Definition at line 40 of file Geometry.h.

40{ this->setCoverageMaskShape(mask); }
void setCoverageMaskShape(const CoverageMaskShape &maskShape)
Definition Geometry.h:155

◆ Geometry() [9/9]

skgpu::graphite::Geometry::Geometry ( const AnalyticBlurMask blur)
inlineexplicit

Definition at line 41 of file Geometry.h.

41{ this->setAnalyticBlur(blur); }
void setAnalyticBlur(const AnalyticBlurMask &blur)
Definition Geometry.h:164

◆ ~Geometry()

skgpu::graphite::Geometry::~Geometry ( )
inline

Definition at line 43 of file Geometry.h.

43{ this->setType(Type::kEmpty); }

Member Function Documentation

◆ analyticBlurMask()

const AnalyticBlurMask & skgpu::graphite::Geometry::analyticBlurMask ( ) const
inline

Definition at line 112 of file Geometry.h.

112 {
114 }
#define SkASSERT(cond)
Definition SkAssert.h:116
bool isAnalyticBlur() const
Definition Geometry.h:101
AnalyticBlurMask fAnalyticBlurMask
Definition Geometry.h:210

◆ bounds()

Rect skgpu::graphite::Geometry::bounds ( ) const
inline

Definition at line 173 of file Geometry.h.

173 {
174 switch (fType) {
175 case Type::kEmpty: return Rect(0, 0, 0, 0);
176 case Type::kShape: return fShape.bounds();
177 case Type::kVertices: return fVertices->bounds();
178 case Type::kSubRun: return fSubRunData.bounds();
179 case Type::kEdgeAAQuad: return fEdgeAAQuad.bounds();
182 }
184 }
#define SkUNREACHABLE
Definition SkAssert.h:135
const SkRect & bounds() const
Definition SkVertices.h:98
CoverageMaskShape fCoverageMaskShape
Definition Geometry.h:209
sk_sp< SkVertices > fVertices
Definition Geometry.h:207
Rect bounds() const
Definition Shape.cpp:69
TRect< Scalar > Rect
Definition rect.h:746

◆ coverageMaskShape()

const CoverageMaskShape & skgpu::graphite::Geometry::coverageMaskShape ( ) const
inline

Definition at line 109 of file Geometry.h.

109 {
111 }
bool isCoverageMaskShape() const
Definition Geometry.h:100

◆ edgeAAQuad()

const EdgeAAQuad & skgpu::graphite::Geometry::edgeAAQuad ( ) const
inline

Definition at line 108 of file Geometry.h.

108{ SkASSERT(this->isEdgeAAQuad()); return fEdgeAAQuad; }
bool isEdgeAAQuad() const
Definition Geometry.h:99

◆ isAnalyticBlur()

bool skgpu::graphite::Geometry::isAnalyticBlur ( ) const
inline

Definition at line 101 of file Geometry.h.

101{ return fType == Type::kAnalyticBlur; }

◆ isCoverageMaskShape()

bool skgpu::graphite::Geometry::isCoverageMaskShape ( ) const
inline

Definition at line 100 of file Geometry.h.

100{ return fType == Type::kCoverageMaskShape; }

◆ isEdgeAAQuad()

bool skgpu::graphite::Geometry::isEdgeAAQuad ( ) const
inline

Definition at line 99 of file Geometry.h.

99{ return fType == Type::kEdgeAAQuad; }

◆ isEmpty()

bool skgpu::graphite::Geometry::isEmpty ( ) const
inline

Definition at line 102 of file Geometry.h.

102 {
103 return fType == (Type::kEmpty) || (this->isShape() && this->shape().isEmpty());
104 }
bool isEmpty() const
Definition Shape.h:59

◆ isShape()

bool skgpu::graphite::Geometry::isShape ( ) const
inline

Definition at line 96 of file Geometry.h.

96{ return fType == Type::kShape; }

◆ isSubRun()

bool skgpu::graphite::Geometry::isSubRun ( ) const
inline

Definition at line 98 of file Geometry.h.

98{ return fType == Type::kSubRun; }

◆ isVertices()

bool skgpu::graphite::Geometry::isVertices ( ) const
inline

Definition at line 97 of file Geometry.h.

97{ return fType == Type::kVertices; }

◆ operator=() [1/2]

Geometry & skgpu::graphite::Geometry::operator= ( const Geometry geom)
inline

Definition at line 79 of file Geometry.h.

79 {
80 switch (geom.type()) {
81 case Type::kEmpty: this->setType(Type::kEmpty); break;
82 case Type::kShape: this->setShape(geom.shape()); break;
83 case Type::kSubRun: this->setSubRun(geom.subRunData()); break;
84 case Type::kVertices: this->setVertices(geom.fVertices); break;
85 case Type::kEdgeAAQuad: this->setEdgeAAQuad(geom.edgeAAQuad()); break;
87 this->setCoverageMaskShape(geom.coverageMaskShape()); break;
88 case Type::kAnalyticBlur: this->setAnalyticBlur(geom.analyticBlurMask()); break;
89 default: break;
90 }
91 return *this;
92 }

◆ operator=() [2/2]

Geometry & skgpu::graphite::Geometry::operator= ( Geometry &&  geom)
inline

Definition at line 45 of file Geometry.h.

45 {
46 if (this != &geom) {
47 switch (geom.type()) {
48 case Type::kEmpty:
49 this->setType(Type::kEmpty);
50 break;
51 case Type::kShape:
52 this->setShape(geom.shape());
53 geom.setType(Type::kEmpty);
54 break;
55 case Type::kVertices:
56 this->setVertices(std::move(geom.fVertices));
57 geom.setType(Type::kEmpty);
58 break;
59 case Type::kSubRun:
60 this->setSubRun(geom.subRunData());
61 geom.setType(Type::kEmpty);
62 break;
64 this->setEdgeAAQuad(geom.edgeAAQuad());
65 geom.setType(Type::kEmpty);
66 break;
68 this->setCoverageMaskShape(geom.coverageMaskShape());
69 geom.setType(Type::kEmpty);
70 break;
72 this->setAnalyticBlur(geom.analyticBlurMask());
73 geom.setType(Type::kEmpty);
74 break;
75 }
76 }
77 return *this;
78 }

◆ refVertices()

sk_sp< SkVertices > skgpu::graphite::Geometry::refVertices ( ) const
inline

Definition at line 116 of file Geometry.h.

116 {
117 SkASSERT(this->isVertices());
118 return fVertices;
119 }
bool isVertices() const
Definition Geometry.h:97

◆ setAnalyticBlur()

void skgpu::graphite::Geometry::setAnalyticBlur ( const AnalyticBlurMask blur)
inline

Definition at line 164 of file Geometry.h.

164 {
165 if (fType == Type::kAnalyticBlur) {
166 fAnalyticBlurMask = blur;
167 } else {
168 this->setType(Type::kAnalyticBlur);
169 new (&fAnalyticBlurMask) AnalyticBlurMask(blur);
170 }
171 }

◆ setCoverageMaskShape()

void skgpu::graphite::Geometry::setCoverageMaskShape ( const CoverageMaskShape maskShape)
inline

Definition at line 155 of file Geometry.h.

155 {
156 if (fType == Type::kCoverageMaskShape) {
157 fCoverageMaskShape = maskShape;
158 } else {
159 this->setType(Type::kCoverageMaskShape);
160 new (&fCoverageMaskShape) CoverageMaskShape(maskShape);
161 }
162 }

◆ setEdgeAAQuad()

void skgpu::graphite::Geometry::setEdgeAAQuad ( const EdgeAAQuad edgeAAQuad)
inline

Definition at line 146 of file Geometry.h.

146 {
147 if (fType == Type::kEdgeAAQuad) {
149 } else {
150 this->setType(Type::kEdgeAAQuad);
151 new (&fEdgeAAQuad) EdgeAAQuad(edgeAAQuad);
152 }
153 }

◆ setShape()

void skgpu::graphite::Geometry::setShape ( const Shape shape)
inline

Definition at line 121 of file Geometry.h.

121 {
122 if (fType == Type::kShape) {
123 fShape = shape;
124 } else {
125 this->setType(Type::kShape);
126 new (&fShape) Shape(shape);
127 }
128 }
Shape

◆ setSubRun()

void skgpu::graphite::Geometry::setSubRun ( const SubRunData subRun)
inline

Definition at line 129 of file Geometry.h.

129 {
130 if (fType == Type::kSubRun) {
131 fSubRunData = subRun;
132 } else {
133 this->setType(Type::kSubRun);
134 new (&fSubRunData) SubRunData(subRun);
135 }
136 }

◆ setVertices()

void skgpu::graphite::Geometry::setVertices ( sk_sp< SkVertices vertices)
inline

Definition at line 137 of file Geometry.h.

137 {
138 if (fType == Type::kVertices) {
139 fVertices = std::move(vertices);
140 } else {
141 this->setType(Type::kVertices);
142 new (&fVertices) sk_sp<SkVertices>(std::move(vertices));
143 }
144 }

◆ shape()

const Shape & skgpu::graphite::Geometry::shape ( ) const
inline

Definition at line 106 of file Geometry.h.

106{ SkASSERT(this->isShape()); return fShape; }

◆ subRunData()

const SubRunData & skgpu::graphite::Geometry::subRunData ( ) const
inline

Definition at line 107 of file Geometry.h.

107{ SkASSERT(this->isSubRun()); return fSubRunData; }
bool isSubRun() const
Definition Geometry.h:98

◆ type()

Type skgpu::graphite::Geometry::type ( ) const
inline

Definition at line 94 of file Geometry.h.

94{ return fType; }

◆ vertices()

const SkVertices * skgpu::graphite::Geometry::vertices ( ) const
inline

Definition at line 115 of file Geometry.h.

115{ SkASSERT(this->isVertices()); return fVertices.get(); }
T * get() const
Definition SkRefCnt.h:303

Member Data Documentation

◆ fAnalyticBlurMask

AnalyticBlurMask skgpu::graphite::Geometry::fAnalyticBlurMask

Definition at line 210 of file Geometry.h.

◆ fCoverageMaskShape

CoverageMaskShape skgpu::graphite::Geometry::fCoverageMaskShape

Definition at line 209 of file Geometry.h.

◆ fEdgeAAQuad

EdgeAAQuad skgpu::graphite::Geometry::fEdgeAAQuad

Definition at line 208 of file Geometry.h.

◆ fShape

Shape skgpu::graphite::Geometry::fShape

Definition at line 205 of file Geometry.h.

◆ fSubRunData

SubRunData skgpu::graphite::Geometry::fSubRunData

Definition at line 206 of file Geometry.h.

◆ fVertices

sk_sp<SkVertices> skgpu::graphite::Geometry::fVertices

Definition at line 207 of file Geometry.h.


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