Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Static Public Attributes | List of all members
GrShape Class Reference

#include <GrShape.h>

Public Types

enum class  Type : uint8_t {
  kEmpty , kPoint , kRect , kRRect ,
  kPath , kArc , kLine
}
 
enum  SimplifyFlags : unsigned { kSimpleFill_Flag = 0b001 , kIgnoreWinding_Flag = 0b010 , kMakeCanonical_Flag = 0b100 , kAll_Flags = 0b111 }
 
using sk_is_trivially_relocatable = std::true_type
 

Public Member Functions

 GrShape ()
 
 GrShape (const SkPoint &point)
 
 GrShape (const SkRect &rect)
 
 GrShape (const SkRRect &rrect)
 
 GrShape (const SkPath &path)
 
 GrShape (const SkArc &arc)
 
 GrShape (const GrLineSegment &line)
 
 GrShape (const GrShape &shape)
 
 ~GrShape ()
 
GrShapeoperator= (const GrShape &shape)
 
bool isEmpty () const
 
bool isPoint () const
 
bool isRect () const
 
bool isRRect () const
 
bool isPath () const
 
bool isArc () const
 
bool isLine () const
 
Type type () const
 
uint32_t stateKey () const
 
bool inverted () const
 
SkPathDirection dir () const
 
unsigned startIndex () const
 
void setPathWindingParams (SkPathDirection dir, unsigned start)
 
void setInverted (bool inverted)
 
SkPointpoint ()
 
const SkPointpoint () const
 
SkRectrect ()
 
const SkRectrect () const
 
SkRRectrrect ()
 
const SkRRectrrect () const
 
SkPathpath ()
 
const SkPathpath () const
 
SkArcarc ()
 
const SkArcarc () const
 
GrLineSegmentline ()
 
const GrLineSegmentline () const
 
void setPoint (const SkPoint &point)
 
void setRect (const SkRect &rect)
 
void setRRect (const SkRRect &rrect)
 
void setArc (const SkArc &arc)
 
void setLine (const GrLineSegment &line)
 
void setPath (const SkPath &path)
 
void reset ()
 
bool simplify (unsigned flags=kAll_Flags)
 
bool conservativeContains (const SkRect &rect) const
 
bool conservativeContains (const SkPoint &point) const
 
bool closed () const
 
bool convex (bool simpleFill=true) const
 
SkRect bounds () const
 
uint32_t segmentMask () const
 
void asPath (SkPath *out, bool simpleFill=true) const
 

Static Public Attributes

static constexpr int kTypeCount = static_cast<int>(Type::kLine) + 1
 
static constexpr SkPathDirection kDefaultDir = SkPathDirection::kCW
 
static constexpr unsigned kDefaultStart = 0
 
static constexpr SkPathFillType kDefaultFillType = SkPathFillType::kEvenOdd
 

Detailed Description

GrShape is a convenience class to represent the many different specialized geometries that Ganesh can handle, including rects, round rects, lines, as well as paths. It is intended as a data-only class where any additional complex behavior is handled by an owning type (e.g. GrStyledShape). However, it does include some basic utilities that unify common functionality (such as contains()) from the underlying shape types.

In order to have lossless simplification of the geometry, it also tracks winding direction, start index, and fill inversion. The direction and index are match the SkPath indexing scheme for the shape's type (e.g. rect, rrect, or oval).

Regarding GrShape's empty shape:

Definition at line 50 of file GrShape.h.

Member Typedef Documentation

◆ sk_is_trivially_relocatable

using GrShape::sk_is_trivially_relocatable = std::true_type

Definition at line 234 of file GrShape.h.

Member Enumeration Documentation

◆ SimplifyFlags

enum GrShape::SimplifyFlags : unsigned
Enumerator
kSimpleFill_Flag 
kIgnoreWinding_Flag 
kMakeCanonical_Flag 
kAll_Flags 

Definition at line 193 of file GrShape.h.

193 : unsigned {
194 // If set, it is assumed the original shape would have been implicitly filled when drawn or
195 // clipped, so simpler shape types that are closed can still be considered. Shapes with
196 // 0 area (i.e. points and lines) can be turned into empty.
197 kSimpleFill_Flag = 0b001,
198 // If set, simplifications that would impact a directional stroke or path effect can still
199 // be taken (e.g. dir and start are not required, arcs can be converted to ovals).
200 kIgnoreWinding_Flag = 0b010,
201 // If set, the geometry will be updated to have sorted coordinates (rects, lines), modulated
202 // sweep angles (arcs).
203 kMakeCanonical_Flag = 0b100,
204
205 kAll_Flags = 0b111
206 };
@ kMakeCanonical_Flag
Definition: GrShape.h:203
@ kIgnoreWinding_Flag
Definition: GrShape.h:200
@ kSimpleFill_Flag
Definition: GrShape.h:197
@ kAll_Flags
Definition: GrShape.h:205

◆ Type

enum class GrShape::Type : uint8_t
strong
Enumerator
kEmpty 
kPoint 
kRect 
kRRect 
kPath 
kArc 
kLine 

Definition at line 53 of file GrShape.h.

53 : uint8_t {
55 };
@ kRRect
constexpr std::array< std::array< float, 2 >, 2 > kRect
@ kPoint
Draws a point at each input vertex.
@ kPath
Definition: SkGlyph.h:317

Constructor & Destructor Documentation

◆ GrShape() [1/8]

GrShape::GrShape ( )
inline

Definition at line 65 of file GrShape.h.

65{}

◆ GrShape() [2/8]

GrShape::GrShape ( const SkPoint point)
inlineexplicit

Definition at line 66 of file GrShape.h.

66{ this->setPoint(point); }
void setPoint(const SkPoint &point)
Definition: GrShape.h:155

◆ GrShape() [3/8]

GrShape::GrShape ( const SkRect rect)
inlineexplicit

Definition at line 67 of file GrShape.h.

67{ this->setRect(rect); }
void setRect(const SkRect &rect)
Definition: GrShape.h:159

◆ GrShape() [4/8]

GrShape::GrShape ( const SkRRect rrect)
inlineexplicit

Definition at line 68 of file GrShape.h.

68{ this->setRRect(rrect); }
void setRRect(const SkRRect &rrect)
Definition: GrShape.h:163

◆ GrShape() [5/8]

GrShape::GrShape ( const SkPath path)
inlineexplicit

Definition at line 69 of file GrShape.h.

69{ this->setPath(path); }
void setPath(const SkPath &path)
Definition: GrShape.h:175

◆ GrShape() [6/8]

GrShape::GrShape ( const SkArc arc)
inlineexplicit

Definition at line 70 of file GrShape.h.

70{ this->setArc(arc); }
void setArc(const SkArc &arc)
Definition: GrShape.h:167

◆ GrShape() [7/8]

GrShape::GrShape ( const GrLineSegment line)
inlineexplicit

Definition at line 71 of file GrShape.h.

71{ this->setLine(line); }
void setLine(const GrLineSegment &line)
Definition: GrShape.h:171

◆ GrShape() [8/8]

GrShape::GrShape ( const GrShape shape)
inline

Definition at line 73 of file GrShape.h.

73{ *this = shape; }

◆ ~GrShape()

GrShape::~GrShape ( )
inline

Definition at line 75 of file GrShape.h.

75{ this->reset(); }
void reset()
Definition: GrShape.h:188

Member Function Documentation

◆ arc() [1/2]

SkArc & GrShape::arc ( )
inline

Definition at line 143 of file GrShape.h.

143{ SkASSERT(this->isArc()); return fArc; }
#define SkASSERT(cond)
Definition: SkAssert.h:116
SkArc fArc
Definition: GrShape.h:274
bool isArc() const
Definition: GrShape.h:89

◆ arc() [2/2]

const SkArc & GrShape::arc ( ) const
inline

Definition at line 144 of file GrShape.h.

144{ SkASSERT(this->isArc()); return fArc; }

◆ asPath()

void GrShape::asPath ( SkPath out,
bool  simpleFill = true 
) const

Definition at line 423 of file GrShape.cpp.

423 {
424 if (!this->isPath() && !this->isArc()) {
425 // When not a path, we need to set fill type on the path to match invertedness.
426 // All the non-path geometries produce equivalent shapes with either even-odd or winding
427 // so we can use the default fill type.
428 out->reset();
429 out->setFillType(kDefaultFillType);
430 if (fInverted) {
431 out->toggleInverseFillType();
432 }
433 } // Else when we're already a path, that will assign the fill type directly to 'out'.
434
435 switch (this->type()) {
436 case Type::kEmpty:
437 return;
438 case Type::kPoint:
439 // A plain moveTo() or moveTo+close() does not match the expected path for a
440 // point that is being dashed (see SkDashPath's handling of zero-length segments).
441 out->moveTo(fPoint);
442 out->lineTo(fPoint);
443 return;
444 case Type::kRect:
445 out->addRect(fRect, this->dir(), this->startIndex());
446 return;
447 case Type::kRRect:
448 out->addRRect(fRRect, this->dir(), this->startIndex());
449 return;
450 case Type::kPath:
451 *out = fPath;
452 return;
453 case Type::kArc:
455 // CreateDrawArcPath resets the output path and configures its fill type, so we just
456 // have to ensure invertedness is correct.
457 if (fInverted) {
458 out->toggleInverseFillType();
459 }
460 return;
461 case Type::kLine:
462 out->moveTo(fLine.fP1);
463 out->lineTo(fLine.fP2);
464 return;
465 }
467}
#define SkUNREACHABLE
Definition: SkAssert.h:135
SkRRect fRRect
Definition: GrShape.h:272
GrLineSegment fLine
Definition: GrShape.h:275
Type type() const
Definition: GrShape.h:92
bool isPath() const
Definition: GrShape.h:88
SkRect fRect
Definition: GrShape.h:271
SkPath fPath
Definition: GrShape.h:273
SkPathDirection dir() const
Definition: GrShape.h:105
static constexpr SkPathFillType kDefaultFillType
Definition: GrShape.h:63
SkPoint fPoint
Definition: GrShape.h:270
unsigned startIndex() const
Definition: GrShape.h:108
static void CreateDrawArcPath(SkPath *path, const SkArc &arc, bool isFillNoPathEffect)
Definition: SkPath.cpp:3356
SkPath & moveTo(SkScalar x, SkScalar y)
Definition: SkPath.cpp:688
SkPath & addRRect(const SkRRect &rrect, SkPathDirection dir=SkPathDirection::kCW)
Definition: SkPath.cpp:1000
SkPath & reset()
Definition: SkPath.cpp:370
SkPoint fP2
Definition: GrShape.h:28
SkPoint fP1
Definition: GrShape.h:27

◆ bounds()

SkRect GrShape::bounds ( ) const

Definition at line 367 of file GrShape.cpp.

367 {
368 // Bounds where left == bottom or top == right can indicate a line or point shape. We return
369 // inverted bounds for a truly empty shape.
370 static constexpr SkRect kInverted = SkRect::MakeLTRB(1, 1, -1, -1);
371 switch (this->type()) {
372 case Type::kEmpty:
373 return kInverted;
374 case Type::kPoint:
375 return {fPoint.fX, fPoint.fY, fPoint.fX, fPoint.fY};
376 case Type::kRect:
377 return fRect.makeSorted();
378 case Type::kRRect:
379 return fRRect.getBounds();
380 case Type::kPath:
381 return fPath.getBounds();
382 case Type::kArc:
383 return fArc.fOval;
384 case Type::kLine: {
387 b.sort();
388 return b; }
389 }
391}
const SkRect & getBounds() const
Definition: SkPath.cpp:430
const SkRect & getBounds() const
Definition: SkRRect.h:279
static bool b
SkRect fOval
Definition: SkArc.h:55
float fX
x-axis value
Definition: SkPoint_impl.h:164
float fY
y-axis value
Definition: SkPoint_impl.h:165
SkRect makeSorted() const
Definition: SkRect.h:1330
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition: SkRect.h:646

◆ closed()

bool GrShape::closed ( ) const

Definition at line 330 of file GrShape.cpp.

330 {
331 switch (this->type()) {
332 case Type::kEmpty: // fall through
333 case Type::kRect: // fall through
334 case Type::kRRect:
335 return true;
336 case Type::kPath:
337 // SkPath doesn't keep track of the closed status of each contour.
339 case Type::kArc:
341 case Type::kPoint: // fall through
342 case Type::kLine:
343 return false;
344 }
346}
static bool IsClosedSingleContour(const SkPath &path)
Definition: SkPathPriv.h:67
Type fType
Definition: SkArc.h:62

◆ conservativeContains() [1/2]

bool GrShape::conservativeContains ( const SkPoint point) const

Definition at line 313 of file GrShape.cpp.

313 {
314 switch (this->type()) {
315 case Type::kEmpty:
316 case Type::kPoint: // fall through, currently choosing not to test if shape == point
317 case Type::kLine: // fall through, ""
318 case Type::kArc:
319 return false;
320 case Type::kRect:
321 return fRect.contains(point.fX, point.fY);
322 case Type::kRRect:
324 case Type::kPath:
325 return fPath.contains(point.fX, point.fY);
326 }
328}
SkPoint & point()
Definition: GrShape.h:131
bool contains(SkScalar x, SkScalar y) const
Definition: SkPath.cpp:3118
static bool ContainsPoint(const SkRRect &rr, const SkPoint &p)
Definition: SkRRectPriv.h:48
bool contains(SkScalar x, SkScalar y) const
Definition: extension.cpp:19

◆ conservativeContains() [2/2]

bool GrShape::conservativeContains ( const SkRect rect) const

Definition at line 289 of file GrShape.cpp.

289 {
290 switch (this->type()) {
291 case Type::kEmpty:
292 case Type::kPoint: // fall through since a point has 0 area
293 case Type::kLine: // fall through, "" (currently choosing not to test if 'rect' == line)
294 return false;
295 case Type::kRect:
296 return fRect.contains(rect);
297 case Type::kRRect:
298 return fRRect.contains(rect);
299 case Type::kPath:
301 case Type::kArc:
303 SkPath arc;
304 this->asPath(&arc);
305 return arc.conservativelyContainsRect(rect);
306 } else {
307 return false;
308 }
309 }
311}
SkRect & rect()
Definition: GrShape.h:134
SkArc & arc()
Definition: GrShape.h:143
void asPath(SkPath *out, bool simpleFill=true) const
Definition: GrShape.cpp:423
Definition: SkPath.h:59
bool conservativelyContainsRect(const SkRect &rect) const
Definition: SkPath.cpp:291
bool contains(const SkRect &rect) const
Definition: SkRRect.cpp:360

◆ convex()

bool GrShape::convex ( bool  simpleFill = true) const

Definition at line 348 of file GrShape.cpp.

348 {
349 switch (this->type()) {
350 case Type::kEmpty: // fall through
351 case Type::kRect: // fall through
352 case Type::kRRect:
353 return true;
354 case Type::kPath:
355 // SkPath.isConvex() really means "is this path convex were it to be closed".
356 // Convex paths may only have one contour hence isLastContourClosed() is sufficient.
357 return (simpleFill || fPath.isLastContourClosed()) && fPath.isConvex();
358 case Type::kArc:
360 case Type::kPoint: // fall through
361 case Type::kLine:
362 return false;
363 }
365}
static bool DrawArcIsConvex(SkScalar sweepAngle, SkArc::Type arcType, bool isFillNoPathEffect)
Definition: SkPath.cpp:3340
bool isConvex() const
Definition: SkPath.cpp:426
bool isLastContourClosed() const
Definition: SkPath.cpp:390
SkScalar fSweepAngle
Definition: SkArc.h:60

◆ dir()

SkPathDirection GrShape::dir ( ) const
inline

Definition at line 105 of file GrShape.h.

◆ inverted()

bool GrShape::inverted ( ) const
inline

Definition at line 99 of file GrShape.h.

99 {
100 return this->isPath() ? fPath.isInverseFillType() : SkToBool(fInverted);
101 }
static constexpr bool SkToBool(const T &x)
Definition: SkTo.h:35
bool isInverseFillType() const
Definition: SkPath.h:244

◆ isArc()

bool GrShape::isArc ( ) const
inline

Definition at line 89 of file GrShape.h.

89{ return this->type() == Type::kArc; }

◆ isEmpty()

bool GrShape::isEmpty ( ) const
inline

Definition at line 84 of file GrShape.h.

84{ return this->type() == Type::kEmpty; }

◆ isLine()

bool GrShape::isLine ( ) const
inline

Definition at line 90 of file GrShape.h.

90{ return this->type() == Type::kLine; }

◆ isPath()

bool GrShape::isPath ( ) const
inline

Definition at line 88 of file GrShape.h.

88{ return this->type() == Type::kPath; }

◆ isPoint()

bool GrShape::isPoint ( ) const
inline

Definition at line 85 of file GrShape.h.

85{ return this->type() == Type::kPoint; }

◆ isRect()

bool GrShape::isRect ( ) const
inline

Definition at line 86 of file GrShape.h.

86{ return this->type() == Type::kRect; }

◆ isRRect()

bool GrShape::isRRect ( ) const
inline

Definition at line 87 of file GrShape.h.

87{ return this->type() == Type::kRRect; }

◆ line() [1/2]

GrLineSegment & GrShape::line ( )
inline

Definition at line 146 of file GrShape.h.

146{ SkASSERT(this->isLine()); return fLine; }
bool isLine() const
Definition: GrShape.h:90

◆ line() [2/2]

const GrLineSegment & GrShape::line ( ) const
inline

Definition at line 147 of file GrShape.h.

147{ SkASSERT(this->isLine()); return fLine; }

◆ operator=()

GrShape & GrShape::operator= ( const GrShape shape)

Definition at line 17 of file GrShape.cpp.

17 {
18 switch (shape.type()) {
19 case Type::kEmpty:
20 this->reset();
21 break;
22 case Type::kPoint:
23 this->setPoint(shape.fPoint);
24 break;
25 case Type::kRect:
26 this->setRect(shape.fRect);
27 break;
28 case Type::kRRect:
29 this->setRRect(shape.fRRect);
30 break;
31 case Type::kPath:
32 this->setPath(shape.fPath);
33 break;
34 case Type::kArc:
35 this->setArc(shape.fArc);
36 break;
37 case Type::kLine:
38 this->setLine(shape.fLine);
39 break;
40 }
41
42 fStart = shape.fStart;
43 fCW = shape.fCW;
44 fInverted = shape.fInverted;
45
46 return *this;
47}

◆ path() [1/2]

SkPath & GrShape::path ( )
inline

Definition at line 140 of file GrShape.h.

140{ SkASSERT(this->isPath()); return fPath; }

◆ path() [2/2]

const SkPath & GrShape::path ( ) const
inline

Definition at line 141 of file GrShape.h.

141{ SkASSERT(this->isPath()); return fPath; }

◆ point() [1/2]

SkPoint & GrShape::point ( )
inline

Definition at line 131 of file GrShape.h.

131{ SkASSERT(this->isPoint()); return fPoint; }
bool isPoint() const
Definition: GrShape.h:85

◆ point() [2/2]

const SkPoint & GrShape::point ( ) const
inline

Definition at line 132 of file GrShape.h.

132{ SkASSERT(this->isPoint()); return fPoint; }

◆ rect() [1/2]

SkRect & GrShape::rect ( )
inline

Definition at line 134 of file GrShape.h.

134{ SkASSERT(this->isRect()); return fRect; }
bool isRect() const
Definition: GrShape.h:86

◆ rect() [2/2]

const SkRect & GrShape::rect ( ) const
inline

Definition at line 135 of file GrShape.h.

135{ SkASSERT(this->isRect()); return fRect; }

◆ reset()

void GrShape::reset ( )
inline

Definition at line 188 of file GrShape.h.

188 {
189 this->reset(Type::kEmpty);
190 }

◆ rrect() [1/2]

SkRRect & GrShape::rrect ( )
inline

Definition at line 137 of file GrShape.h.

137{ SkASSERT(this->isRRect()); return fRRect; }
bool isRRect() const
Definition: GrShape.h:87

◆ rrect() [2/2]

const SkRRect & GrShape::rrect ( ) const
inline

Definition at line 138 of file GrShape.h.

138{ SkASSERT(this->isRRect()); return fRRect; }

◆ segmentMask()

uint32_t GrShape::segmentMask ( ) const

Definition at line 393 of file GrShape.cpp.

393 {
394 // In order to match what a path would report, this has to inspect the shapes slightly
395 // to reflect what they might simplify to.
396 switch (this->type()) {
397 case Type::kEmpty:
398 return 0;
399 case Type::kRRect:
400 if (fRRect.isEmpty() || fRRect.isRect()) {
402 } else if (fRRect.isOval()) {
404 } else {
406 }
407 case Type::kPath:
408 return fPath.getSegmentMasks();
409 case Type::kArc:
412 } else {
414 }
415 case Type::kPoint: // fall through
416 case Type::kLine: // ""
417 case Type::kRect:
419 }
421}
@ kLine_SegmentMask
Definition: SkPath.h:1445
@ kConic_SegmentMask
Definition: SkPath.h:1447
uint32_t getSegmentMasks() const
Definition: SkPath.cpp:434
bool isOval() const
Definition: SkRRect.h:85
bool isRect() const
Definition: SkRRect.h:84
bool isEmpty() const
Definition: SkRRect.h:83

◆ setArc()

void GrShape::setArc ( const SkArc arc)
inline

Definition at line 167 of file GrShape.h.

167 {
168 this->reset(Type::kArc);
169 fArc = arc;
170 }

◆ setInverted()

void GrShape::setInverted ( bool  inverted)
inline

Definition at line 119 of file GrShape.h.

119 {
120 if (this->isPath()) {
123 }
124 } else {
125 fInverted = inverted;
126 }
127 }
bool inverted() const
Definition: GrShape.h:99
void toggleInverseFillType()
Definition: SkPath.h:249

◆ setLine()

void GrShape::setLine ( const GrLineSegment line)
inline

Definition at line 171 of file GrShape.h.

171 {
172 this->reset(Type::kLine);
173 fLine = line;
174 }
GrLineSegment & line()
Definition: GrShape.h:146

◆ setPath()

void GrShape::setPath ( const SkPath path)
inline

Definition at line 175 of file GrShape.h.

175 {
176 if (this->isPath()) {
177 // Assign directly
178 fPath = path;
179 } else {
180 // In-place initialize
181 this->setType(Type::kPath);
182 new (&fPath) SkPath(path);
183 }
184 // Must also set these since we didn't call reset() like other setX functions.
186 fInverted = path.isInverseFillType();
187 }
SkPath & path()
Definition: GrShape.h:140
void setPathWindingParams(SkPathDirection dir, unsigned start)
Definition: GrShape.h:112
static constexpr SkPathDirection kDefaultDir
Definition: GrShape.h:60
static constexpr unsigned kDefaultStart
Definition: GrShape.h:61

◆ setPathWindingParams()

void GrShape::setPathWindingParams ( SkPathDirection  dir,
unsigned  start 
)
inline

Definition at line 112 of file GrShape.h.

112 {
113 SkASSERT((this->isRect() && start < 4) || (this->isRRect() && start < 8) ||
115 fCW = dir == SkPathDirection::kCW;
116 fStart = static_cast<uint8_t>(start);
117 }

◆ setPoint()

void GrShape::setPoint ( const SkPoint point)
inline

Definition at line 155 of file GrShape.h.

155 {
156 this->reset(Type::kPoint);
157 fPoint = point;
158 }

◆ setRect()

void GrShape::setRect ( const SkRect rect)
inline

Definition at line 159 of file GrShape.h.

159 {
160 this->reset(Type::kRect);
161 fRect = rect;
162 }

◆ setRRect()

void GrShape::setRRect ( const SkRRect rrect)
inline

Definition at line 163 of file GrShape.h.

163 {
164 this->reset(Type::kRRect);
165 fRRect = rrect;
166 }
SkRRect & rrect()
Definition: GrShape.h:137

◆ simplify()

bool GrShape::simplify ( unsigned  flags = kAll_Flags)

Definition at line 244 of file GrShape.cpp.

244 {
245 // Verify that winding parameters are valid for the current type.
246 SkASSERT((fType == Type::kRect || fType == Type::kRRect) ||
247 (this->dir() == kDefaultDir && this->startIndex() == kDefaultStart));
248
249 // The type specific functions automatically fall through to the simpler shapes, so
250 // we only need to start in the right place.
251 bool wasClosed = false;
252 switch (fType) {
253 case Type::kEmpty:
254 // do nothing
255 break;
256 case Type::kPoint:
257 this->simplifyPoint(fPoint, flags);
258 break;
259 case Type::kLine:
260 this->simplifyLine(fLine.fP1, fLine.fP2, flags);
261 break;
262 case Type::kRect:
263 this->simplifyRect(fRect, this->dir(), this->startIndex(), flags);
264 wasClosed = true;
265 break;
266 case Type::kRRect:
267 this->simplifyRRect(fRRect, this->dir(), this->startIndex(), flags);
268 wasClosed = true;
269 break;
270 case Type::kPath:
271 wasClosed = this->simplifyPath(flags);
272 break;
273 case Type::kArc:
274 wasClosed = this->simplifyArc(flags);
275 break;
276
277 default:
279 }
280
281 if (((flags & kIgnoreWinding_Flag) || (fType != Type::kRect && fType != Type::kRRect))) {
282 // Reset winding parameters if we don't need them anymore
284 }
285
286 return wasClosed;
287}
FlutterSemanticsFlag flags

◆ startIndex()

unsigned GrShape::startIndex ( ) const
inline

Definition at line 108 of file GrShape.h.

108{ return fStart; }

◆ stateKey()

uint32_t GrShape::stateKey ( ) const

Definition at line 49 of file GrShape.cpp.

49 {
50 // Use the path's full fill type instead of just whether or not it's inverted.
51 uint32_t key = this->isPath() ? static_cast<uint32_t>(fPath.getFillType())
52 : (fInverted ? 1 : 0);
53 key |= ((uint32_t) fType) << 2; // fill type was 2 bits
54 key |= fStart << 5; // type was 3 bits, total 5 bits so far
55 key |= (fCW ? 1 : 0) << 8; // start was 3 bits, total 8 bits so far
56 return key;
57}
SkPathFillType getFillType() const
Definition: SkPath.h:230

◆ type()

Type GrShape::type ( ) const
inline

Definition at line 92 of file GrShape.h.

92{ return fType; }

Member Data Documentation

◆ fArc

SkArc GrShape::fArc

Definition at line 274 of file GrShape.h.

◆ fLine

GrLineSegment GrShape::fLine

Definition at line 275 of file GrShape.h.

◆ fPath

SkPath GrShape::fPath

Definition at line 273 of file GrShape.h.

◆ fPoint

SkPoint GrShape::fPoint

Definition at line 270 of file GrShape.h.

◆ fRect

SkRect GrShape::fRect

Definition at line 271 of file GrShape.h.

◆ fRRect

SkRRect GrShape::fRRect

Definition at line 272 of file GrShape.h.

◆ kDefaultDir

constexpr SkPathDirection GrShape::kDefaultDir = SkPathDirection::kCW
inlinestaticconstexpr

Definition at line 60 of file GrShape.h.

◆ kDefaultFillType

constexpr SkPathFillType GrShape::kDefaultFillType = SkPathFillType::kEvenOdd
inlinestaticconstexpr

Definition at line 63 of file GrShape.h.

◆ kDefaultStart

constexpr unsigned GrShape::kDefaultStart = 0
inlinestaticconstexpr

Definition at line 61 of file GrShape.h.

◆ kTypeCount

constexpr int GrShape::kTypeCount = static_cast<int>(Type::kLine) + 1
inlinestaticconstexpr

Definition at line 56 of file GrShape.h.


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