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

#include <SkPathRef.h>

Public Member Functions

 Iter ()
 
 Iter (const SkPathRef &)
 
void setPathRef (const SkPathRef &)
 
uint8_t next (SkPoint pts[4])
 
uint8_t peek () const
 
SkScalar conicWeight () const
 

Detailed Description

Definition at line 179 of file SkPathRef.h.

Constructor & Destructor Documentation

◆ Iter() [1/2]

SkPathRef::Iter::Iter ( )

Definition at line 539 of file SkPathRef.cpp.

539 {
540#ifdef SK_DEBUG
541 fPts = nullptr;
542 fConicWeights = nullptr;
543#endif
544 // need to init enough to make next() harmlessly return kDone_Verb
545 fVerbs = nullptr;
546 fVerbStop = nullptr;
547}

◆ Iter() [2/2]

SkPathRef::Iter::Iter ( const SkPathRef path)

Definition at line 549 of file SkPathRef.cpp.

549 {
550 this->setPathRef(path);
551}
void setPathRef(const SkPathRef &)
Definition: SkPathRef.cpp:553

Member Function Documentation

◆ conicWeight()

SkScalar SkPathRef::Iter::conicWeight ( ) const
inline

Definition at line 198 of file SkPathRef.h.

198{ return *fConicWeights; }

◆ next()

uint8_t SkPathRef::Iter::next ( SkPoint  pts[4])

Return the next verb in this iteration of the path. When all segments have been visited, return kDone_Verb.

If any point in the path is non-finite, return kDone_Verb immediately.

Parameters
ptsThe points representing the current verb and/or segment This must not be NULL.
Returns
The verb for the current segment

Definition at line 568 of file SkPathRef.cpp.

568 {
569 SkASSERT(pts);
570
571 SkDEBUGCODE(unsigned peekResult = this->peek();)
572
573 if (fVerbs == fVerbStop) {
574 SkASSERT(peekResult == SkPath::kDone_Verb);
575 return (uint8_t) SkPath::kDone_Verb;
576 }
577
578 // fVerbs points one beyond next verb so decrement first.
579 unsigned verb = *fVerbs++;
580 const SkPoint* srcPts = fPts;
581
582 switch (verb) {
584 pts[0] = srcPts[0];
585 srcPts += 1;
586 break;
588 pts[0] = srcPts[-1];
589 pts[1] = srcPts[0];
590 srcPts += 1;
591 break;
593 fConicWeights += 1;
594 [[fallthrough]];
596 pts[0] = srcPts[-1];
597 pts[1] = srcPts[0];
598 pts[2] = srcPts[1];
599 srcPts += 2;
600 break;
602 pts[0] = srcPts[-1];
603 pts[1] = srcPts[0];
604 pts[2] = srcPts[1];
605 pts[3] = srcPts[2];
606 srcPts += 3;
607 break;
609 break;
611 SkASSERT(fVerbs == fVerbStop);
612 break;
613 }
614 fPts = srcPts;
615 SkASSERT(peekResult == verb);
616 return (uint8_t) verb;
617}
#define SkASSERT(cond)
Definition: SkAssert.h:116
uint8_t peek() const
Definition: SkPathRef.cpp:619
SkDEBUGCODE(void validate() const { SkASSERT(this->isValid());}) void reset()
@ kClose_Verb
Definition: SkPath.h:1471
@ kMove_Verb
Definition: SkPath.h:1466
@ kConic_Verb
Definition: SkPath.h:1469
@ kDone_Verb
Definition: SkPath.h:1472
@ kCubic_Verb
Definition: SkPath.h:1470
@ kQuad_Verb
Definition: SkPath.h:1468
@ kLine_Verb
Definition: SkPath.h:1467

◆ peek()

uint8_t SkPathRef::Iter::peek ( ) const

Definition at line 619 of file SkPathRef.cpp.

619 {
620 return fVerbs < fVerbStop ? *fVerbs : (uint8_t) SkPath::kDone_Verb;
621}

◆ setPathRef()

void SkPathRef::Iter::setPathRef ( const SkPathRef path)

Definition at line 553 of file SkPathRef.cpp.

553 {
554 fPts = path.points();
555 fVerbs = path.verbsBegin();
556 fVerbStop = path.verbsEnd();
557 fConicWeights = path.conicWeights();
558 if (fConicWeights) {
559 fConicWeights -= 1; // begin one behind
560 }
561
562 // Don't allow iteration through non-finite points.
563 if (!path.isFinite()) {
564 fVerbStop = fVerbs;
565 }
566}
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

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