Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
SkPathRef::Editor Class Reference

#include <SkPathRef.h>

Public Member Functions

 Editor (sk_sp< SkPathRef > *pathRef, int incReserveVerbs=0, int incReservePoints=0, int incReserveConics=0)
 
 ~Editor ()
 
SkPointwritablePoints ()
 
const SkPointpoints () const
 
SkPointatPoint (int i)
 
const SkPointatPoint (int i) const
 
SkPointgrowForVerb (int verb, SkScalar weight=0)
 
SkPointgrowForRepeatedVerb (int verb, int numVbs, SkScalar **weights=nullptr)
 
std::tuple< SkPoint *, SkScalar * > growForVerbsInPath (const SkPathRef &path)
 
void resetToSize (int newVerbCnt, int newPointCnt, int newConicCount)
 
SkPathRefpathRef ()
 
void setIsOval (bool isCCW, unsigned start, bool isClosed)
 
void setIsRRect (bool isCCW, unsigned start)
 
void setIsArc (const SkArc &arc)
 
void setBounds (const SkRect &rect)
 

Detailed Description

Definition at line 93 of file SkPathRef.h.

Constructor & Destructor Documentation

◆ Editor()

SkPathRef::Editor::Editor ( sk_sp< SkPathRef > *  pathRef,
int  incReserveVerbs = 0,
int  incReservePoints = 0,
int  incReserveConics = 0 
)

Definition at line 27 of file SkPathRef.cpp.

31{
32 SkASSERT(incReserveVerbs >= 0);
33 SkASSERT(incReservePoints >= 0);
34
35 if ((*pathRef)->unique()) {
36 (*pathRef)->incReserve(incReserveVerbs, incReservePoints, incReserveConics);
37 } else {
39 // No need to copy if the existing ref is the empty ref (because it doesn't contain
40 // anything).
41 if (!(*pathRef)->isInitialEmptyPathRef()) {
42 copy = new SkPathRef;
43 copy->copy(**pathRef, incReserveVerbs, incReservePoints, incReserveConics);
44 } else {
45 // Size previously empty paths to exactly fit the supplied hints. The assumpion is
46 // the caller knows the exact size they want (as happens in chrome when deserializing
47 // paths).
48 copy = new SkPathRef(incReserveVerbs, incReservePoints, incReserveConics);
49 }
50 pathRef->reset(copy);
51 }
52 fPathRef = pathRef->get();
53 fPathRef->callGenIDChangeListeners();
54 fPathRef->fGenerationID = 0;
55 fPathRef->fBoundsIsDirty = true;
56 SkDEBUGCODE(fPathRef->fEditorsAttached++;)
57}
#define SkASSERT(cond)
Definition: SkAssert.h:116
SkPathRef * pathRef()
Definition: SkPathRef.h:159
SkDEBUGCODE(void validate() const { SkASSERT(this->isValid());}) void reset()
SkPathRef(SkSpan< const SkPoint > points, SkSpan< const uint8_t > verbs, SkSpan< const SkScalar > weights, unsigned segmentMask)
Definition: SkPathRef.h:71
Definition: copy.py:1

◆ ~Editor()

SkPathRef::Editor::~Editor ( )
inline

Definition at line 100 of file SkPathRef.h.

100{ SkDEBUGCODE(fPathRef->fEditorsAttached--;) }

Member Function Documentation

◆ atPoint() [1/2]

SkPoint * SkPathRef::Editor::atPoint ( int  i)
inline

Gets the ith point. Shortcut for this->points() + i

Definition at line 111 of file SkPathRef.h.

111{ return fPathRef->getWritablePoints() + i; }

◆ atPoint() [2/2]

const SkPoint * SkPathRef::Editor::atPoint ( int  i) const
inline

Definition at line 112 of file SkPathRef.h.

112{ return &fPathRef->fPoints[i]; }

◆ growForRepeatedVerb()

SkPoint * SkPathRef::Editor::growForRepeatedVerb ( int  verb,
int  numVbs,
SkScalar **  weights = nullptr 
)
inline

Allocates space for multiple instances of a particular verb and the requisite points & weights. The return pointer points at the first new point (indexed normally []). If 'verb' is kConic_Verb, 'weights' will return a pointer to the space for the conic weights (indexed normally).

Definition at line 131 of file SkPathRef.h.

133 {
134 return fPathRef->growForRepeatedVerb(verb, numVbs, weights);
135 }

◆ growForVerb()

SkPoint * SkPathRef::Editor::growForVerb ( int  verb,
SkScalar  weight = 0 
)
inline

Adds the verb and allocates space for the number of points indicated by the verb. The return value is a pointer to where the points for the verb should be written. 'weight' is only used if 'verb' is kConic_Verb

Definition at line 119 of file SkPathRef.h.

119 {
120 SkDEBUGCODE(fPathRef->validate();)
121 return fPathRef->growForVerb(verb, weight);
122 }
SkPoint * growForVerb(int verb, SkScalar weight=0)
Definition: SkPathRef.h:119

◆ growForVerbsInPath()

std::tuple< SkPoint *, SkScalar * > SkPathRef::Editor::growForVerbsInPath ( const SkPathRef path)
inline

Concatenates all verbs from 'path' onto the pathRef's verbs array. Increases the point count by the number of points in 'path', and the conic weight count by the number of conics in 'path'.

Returns pointers to the uninitialized points and conic weights data.

Definition at line 144 of file SkPathRef.h.

144 {
145 return fPathRef->growForVerbsInPath(path);
146 }
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57

◆ pathRef()

SkPathRef * SkPathRef::Editor::pathRef ( )
inline

Gets the path ref that is wrapped in the Editor.

Definition at line 159 of file SkPathRef.h.

159{ return fPathRef; }

◆ points()

const SkPoint * SkPathRef::Editor::points ( ) const
inline

Definition at line 106 of file SkPathRef.h.

106{ return fPathRef->points(); }
const SkPoint * points() const
Definition: SkPathRef.h:326

◆ resetToSize()

void SkPathRef::Editor::resetToSize ( int  newVerbCnt,
int  newPointCnt,
int  newConicCount 
)
inline

Resets the path ref to a new verb and point count. The new verbs and points are uninitialized.

Definition at line 152 of file SkPathRef.h.

152 {
153 fPathRef->resetToSize(newVerbCnt, newPointCnt, newConicCount);
154 }

◆ setBounds()

void SkPathRef::Editor::setBounds ( const SkRect rect)
inline

Definition at line 173 of file SkPathRef.h.

173{ fPathRef->setBounds(rect); }
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350

◆ setIsArc()

void SkPathRef::Editor::setIsArc ( const SkArc arc)
inline

Definition at line 169 of file SkPathRef.h.

169 {
170 fPathRef->setIsArc(arc);
171 }

◆ setIsOval()

void SkPathRef::Editor::setIsOval ( bool  isCCW,
unsigned  start,
bool  isClosed 
)
inline

Definition at line 161 of file SkPathRef.h.

161 {
162 fPathRef->setIsOval(isCCW, start, isClosed);
163 }

◆ setIsRRect()

void SkPathRef::Editor::setIsRRect ( bool  isCCW,
unsigned  start 
)
inline

Definition at line 165 of file SkPathRef.h.

165 {
166 fPathRef->setIsRRect(isCCW, start);
167 }

◆ writablePoints()

SkPoint * SkPathRef::Editor::writablePoints ( )
inline

Returns the array of points.

Definition at line 105 of file SkPathRef.h.

105{ return fPathRef->getWritablePoints(); }

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