Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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)
 
void setIsRRect (bool isCCW, unsigned start)
 
void setIsArc (const SkArc &arc)
 
void setBounds (const SkRect &rect)
 

Detailed Description

Definition at line 92 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 26 of file SkPathRef.cpp.

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

◆ ~Editor()

SkPathRef::Editor::~Editor ( )
inline

Definition at line 99 of file SkPathRef.h.

99{ 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 110 of file SkPathRef.h.

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

◆ atPoint() [2/2]

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

Definition at line 111 of file SkPathRef.h.

111{ 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 130 of file SkPathRef.h.

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

◆ 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 118 of file SkPathRef.h.

118 {
119 SkDEBUGCODE(fPathRef->validate();)
120 return fPathRef->growForVerb(verb, weight);
121 }

◆ 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 143 of file SkPathRef.h.

143 {
144 return fPathRef->growForVerbsInPath(path);
145 }

◆ pathRef()

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

Gets the path ref that is wrapped in the Editor.

Definition at line 158 of file SkPathRef.h.

158{ return fPathRef; }

◆ points()

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

Definition at line 105 of file SkPathRef.h.

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

◆ 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 151 of file SkPathRef.h.

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

◆ setBounds()

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

Definition at line 172 of file SkPathRef.h.

172{ fPathRef->setBounds(rect); }

◆ setIsArc()

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

Definition at line 168 of file SkPathRef.h.

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

◆ setIsOval()

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

Definition at line 160 of file SkPathRef.h.

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

◆ setIsRRect()

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

Definition at line 164 of file SkPathRef.h.

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

◆ writablePoints()

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

Returns the array of points.

Definition at line 104 of file SkPathRef.h.

104{ return fPathRef->getWritablePoints(); }

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