Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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.

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 421 of file GrShape.cpp.

421 {
422 if (!this->isPath() && !this->isArc()) {
423 // When not a path, we need to set fill type on the path to match invertedness.
424 // All the non-path geometries produce equivalent shapes with either even-odd or winding
425 // so we can use the default fill type.
426 out->reset();
427 out->setFillType(kDefaultFillType);
428 if (fInverted) {
429 out->toggleInverseFillType();
430 }
431 } // Else when we're already a path, that will assign the fill type directly to 'out'.
432
433 switch (this->type()) {
434 case Type::kEmpty:
435 return;
436 case Type::kPoint:
437 // A plain moveTo() or moveTo+close() does not match the expected path for a
438 // point that is being dashed (see SkDashPath's handling of zero-length segments).
439 out->moveTo(fPoint);
440 out->lineTo(fPoint);
441 return;
442 case Type::kRect:
443 out->addRect(fRect, this->dir(), this->startIndex());
444 return;
445 case Type::kRRect:
446 out->addRRect(fRRect, this->dir(), this->startIndex());
447 return;
448 case Type::kPath:
449 *out = fPath;
450 return;
451 case Type::kArc:
453 fArc.fUseCenter, simpleFill);
454 // CreateDrawArcPath resets the output path and configures its fill type, so we just
455 // have to ensure invertedness is correct.
456 if (fInverted) {
457 out->toggleInverseFillType();
458 }
459 return;
460 case Type::kLine:
461 out->moveTo(fLine.fP1);
462 out->lineTo(fLine.fP2);
463 return;
464 }
466}
#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 SkRect &oval, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, bool isFillNoPathEffect)
Definition SkPath.cpp:3290
SkPath & moveTo(SkScalar x, SkScalar y)
Definition SkPath.cpp:678
SkPath & addRRect(const SkRRect &rrect, SkPathDirection dir=SkPathDirection::kCW)
Definition SkPath.cpp:990
SkPath & reset()
Definition SkPath.cpp:360
SkPoint fP2
Definition GrShape.h:28
SkPoint fP1
Definition GrShape.h:27
bool fUseCenter
Definition SkArc.h:26
SkScalar fSweepAngle
Definition SkArc.h:22
SkScalar fStartAngle
Definition SkArc.h:20
SkRect fOval
Definition SkArc.h:17

◆ bounds()

SkRect GrShape::bounds ( ) const

Definition at line 365 of file GrShape.cpp.

365 {
366 // Bounds where left == bottom or top == right can indicate a line or point shape. We return
367 // inverted bounds for a truly empty shape.
368 static constexpr SkRect kInverted = SkRect::MakeLTRB(1, 1, -1, -1);
369 switch (this->type()) {
370 case Type::kEmpty:
371 return kInverted;
372 case Type::kPoint:
373 return {fPoint.fX, fPoint.fY, fPoint.fX, fPoint.fY};
374 case Type::kRect:
375 return fRect.makeSorted();
376 case Type::kRRect:
377 return fRRect.getBounds();
378 case Type::kPath:
379 return fPath.getBounds();
380 case Type::kArc:
381 return fArc.fOval;
382 case Type::kLine: {
385 b.sort();
386 return b; }
387 }
389}
const SkRect & getBounds() const
Definition SkPath.cpp:420
const SkRect & getBounds() const
Definition SkRRect.h:279
static bool b
float fX
x-axis value
float fY
y-axis value
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 328 of file GrShape.cpp.

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

◆ conservativeContains() [1/2]

bool GrShape::conservativeContains ( const SkPoint point) const

Definition at line 311 of file GrShape.cpp.

311 {
312 switch (this->type()) {
313 case Type::kEmpty:
314 case Type::kPoint: // fall through, currently choosing not to test if shape == point
315 case Type::kLine: // fall through, ""
316 case Type::kArc:
317 return false;
318 case Type::kRect:
319 return fRect.contains(point.fX, point.fY);
320 case Type::kRRect:
322 case Type::kPath:
323 return fPath.contains(point.fX, point.fY);
324 }
326}
SkPoint & point()
Definition GrShape.h:131
bool contains(SkScalar x, SkScalar y) const
Definition SkPath.cpp:3054
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 287 of file GrShape.cpp.

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

◆ convex()

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

Definition at line 346 of file GrShape.cpp.

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

◆ 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 16 of file GrShape.cpp.

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

◆ 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 391 of file GrShape.cpp.

391 {
392 // In order to match what a path would report, this has to inspect the shapes slightly
393 // to reflect what they might simplify to.
394 switch (this->type()) {
395 case Type::kEmpty:
396 return 0;
397 case Type::kRRect:
398 if (fRRect.isEmpty() || fRRect.isRect()) {
400 } else if (fRRect.isOval()) {
402 } else {
404 }
405 case Type::kPath:
406 return fPath.getSegmentMasks();
407 case Type::kArc:
408 if (fArc.fUseCenter) {
410 } else {
412 }
413 case Type::kPoint: // fall through
414 case Type::kLine: // ""
415 case Type::kRect:
417 }
419}
@ kLine_SegmentMask
Definition SkPath.h:1437
@ kConic_SegmentMask
Definition SkPath.h:1439
uint32_t getSegmentMasks() const
Definition SkPath.cpp:424
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 242 of file GrShape.cpp.

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

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