Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
SkPath::RawIter Class Reference

#include <SkPath.h>

Public Member Functions

 RawIter ()
 
 RawIter (const SkPath &path)
 
void setPath (const SkPath &)
 
Verb next (SkPoint[4])
 
Verb peek () const
 
SkScalar conicWeight () const
 

Friends

class SkPath
 

Detailed Description

Use Iter instead. This class will soon be removed and RangeIter will be made private.

Definition at line 1642 of file SkPath.h.

Constructor & Destructor Documentation

◆ RawIter() [1/2]

SkPath::RawIter::RawIter ( )
inline

Initializes RawIter with an empty SkPath. next() on RawIter returns kDone_Verb. Call setPath to initialize SkPath::Iter at a later time.

Returns
RawIter of empty SkPath

Definition at line 1650 of file SkPath.h.

1650{}

◆ RawIter() [2/2]

SkPath::RawIter::RawIter ( const SkPath path)
inline

Sets RawIter to return elements of verb array, SkPoint array, and conic weight in path.

Parameters
pathSkPath to iterate
Returns
RawIter of path

Definition at line 1657 of file SkPath.h.

1657 {
1658 setPath(path);
1659 }
void setPath(const SkPath &)
Definition SkPath.cpp:1911

Member Function Documentation

◆ conicWeight()

SkScalar SkPath::RawIter::conicWeight ( ) const
inline

Returns conic weight if next() returned kConic_Verb.

If next() has not been called, or next() did not return kConic_Verb, result is undefined.

Returns
conic weight for conic SkPoint returned by next()

Definition at line 1692 of file SkPath.h.

1692 {
1693 return fConicWeight;
1694 }

◆ next()

SkPath::Verb SkPath::RawIter::next ( SkPoint  pts[4])

Returns next SkPath::Verb in verb array, and advances RawIter. When verb array is exhausted, returns kDone_Verb. Zero to four SkPoint are stored in pts, depending on the returned SkPath::Verb.

Parameters
ptsstorage for SkPoint data describing returned SkPath::Verb
Returns
next SkPath::Verb from verb array

Definition at line 1917 of file SkPath.cpp.

1917 {
1918 if (!(fIter != fEnd)) {
1919 return kDone_Verb;
1920 }
1921 auto [verb, iterPts, weights] = *fIter;
1922 int numPts;
1923 switch (verb) {
1924 case SkPathVerb::kMove: numPts = 1; break;
1925 case SkPathVerb::kLine: numPts = 2; break;
1926 case SkPathVerb::kQuad: numPts = 3; break;
1927 case SkPathVerb::kConic:
1928 numPts = 3;
1929 fConicWeight = *weights;
1930 break;
1931 case SkPathVerb::kCubic: numPts = 4; break;
1932 case SkPathVerb::kClose: numPts = 0; break;
1933 }
1934 memcpy(pts, iterPts, sizeof(SkPoint) * numPts);
1935 ++fIter;
1936 return (Verb) verb;
1937}
@ kClose
SkPath::RawIter returns 0 points.
@ kCubic
SkPath::RawIter returns 4 points.
@ kConic
SkPath::RawIter returns 3 points + 1 weight.
@ kQuad
SkPath::RawIter returns 3 points.
@ kMove
SkPath::RawIter returns 1 point.
@ kLine
SkPath::RawIter returns 2 points.
@ kDone_Verb
Definition SkPath.h:1464

◆ peek()

Verb SkPath::RawIter::peek ( ) const
inline

Returns next SkPath::Verb, but does not advance RawIter.

Returns
next SkPath::Verb from verb array

Definition at line 1681 of file SkPath.h.

1681 {
1682 return (fIter != fEnd) ? static_cast<Verb>(std::get<0>(*fIter)) : kDone_Verb;
1683 }

◆ setPath()

void SkPath::RawIter::setPath ( const SkPath path)

Sets SkPath::Iter to return elements of verb array, SkPoint array, and conic weight in path.

Parameters
pathSkPath to iterate

Definition at line 1911 of file SkPath.cpp.

1911 {
1912 SkPathPriv::Iterate iterate(path);
1913 fIter = iterate.begin();
1914 fEnd = iterate.end();
1915}

Friends And Related Symbol Documentation

◆ SkPath

friend class SkPath
friend

Definition at line 1700 of file SkPath.h.


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