Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
SkPathEdgeIter Class Reference

#include <SkPathPriv.h>

Classes

struct  Result
 

Public Types

enum class  Edge { kLine = SkPath::kLine_Verb , kQuad = SkPath::kQuad_Verb , kConic = SkPath::kConic_Verb , kCubic = SkPath::kCubic_Verb }
 

Public Member Functions

 SkPathEdgeIter (const SkPath &path)
 
SkScalar conicWeight () const
 
Result next ()
 

Static Public Member Functions

static SkPath::Verb EdgeToVerb (Edge e)
 

Detailed Description

Definition at line 442 of file SkPathPriv.h.

Member Enumeration Documentation

◆ Edge

enum class SkPathEdgeIter::Edge
strong
Enumerator
kLine 
kQuad 
kConic 
kCubic 

Definition at line 465 of file SkPathPriv.h.

Constructor & Destructor Documentation

◆ SkPathEdgeIter()

SkPathEdgeIter::SkPathEdgeIter ( const SkPath path)

Definition at line 3942 of file SkPath.cpp.

3942 {
3943 fMoveToPtr = fPts = path.fPathRef->points();
3944 fVerbs = path.fPathRef->verbsBegin();
3945 fVerbsStop = path.fPathRef->verbsEnd();
3946 fConicWeights = path.fPathRef->conicWeights();
3947 if (fConicWeights) {
3948 fConicWeights -= 1; // begin one behind
3949 }
3950
3951 fNeedsCloseLine = false;
3952 fNextIsNewContour = false;
3953 SkDEBUGCODE(fIsConic = false;)
3954}
#define SkDEBUGCODE(...)
Definition SkDebug.h:23
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

Member Function Documentation

◆ conicWeight()

SkScalar SkPathEdgeIter::conicWeight ( ) const
inline

Definition at line 460 of file SkPathPriv.h.

460 {
461 SkASSERT(fIsConic);
462 return *fConicWeights;
463 }
#define SkASSERT(cond)
Definition SkAssert.h:116

◆ EdgeToVerb()

static SkPath::Verb SkPathEdgeIter::EdgeToVerb ( Edge  e)
inlinestatic

Definition at line 472 of file SkPathPriv.h.

472 {
473 return SkPath::Verb(e);
474 }

◆ next()

Result SkPathEdgeIter::next ( )
inline

Definition at line 485 of file SkPathPriv.h.

485 {
486 auto closeline = [&]() {
487 fScratch[0] = fPts[-1];
488 fScratch[1] = *fMoveToPtr;
489 fNeedsCloseLine = false;
490 fNextIsNewContour = true;
491 return Result{ fScratch, Edge::kLine, false };
492 };
493
494 for (;;) {
495 SkASSERT(fVerbs <= fVerbsStop);
496 if (fVerbs == fVerbsStop) {
497 return fNeedsCloseLine
498 ? closeline()
499 : Result{ nullptr, Edge(kIllegalEdgeValue), false };
500 }
501
502 SkDEBUGCODE(fIsConic = false;)
503
504 const auto v = *fVerbs++;
505 switch (v) {
506 case SkPath::kMove_Verb: {
507 if (fNeedsCloseLine) {
508 auto res = closeline();
509 fMoveToPtr = fPts++;
510 return res;
511 }
512 fMoveToPtr = fPts++;
513 fNextIsNewContour = true;
514 } break;
516 if (fNeedsCloseLine) return closeline();
517 break;
518 default: {
519 // Actual edge.
520 const int pts_count = (v+2) / 2,
521 cws_count = (v & (v-1)) / 2;
522 SkASSERT(pts_count == SkPathPriv::PtsInIter(v) - 1);
523
524 fNeedsCloseLine = true;
525 fPts += pts_count;
526 fConicWeights += cws_count;
527
528 SkDEBUGCODE(fIsConic = (v == SkPath::kConic_Verb);)
529 SkASSERT(fIsConic == (cws_count > 0));
530
531 bool isNewContour = fNextIsNewContour;
532 fNextIsNewContour = false;
533 return { &fPts[-(pts_count + 1)], Edge(v), isNewContour };
534 }
535 }
536 }
537 }
static int PtsInIter(unsigned verb)
Definition SkPathPriv.h:305
@ kClose_Verb
Definition SkPath.h:1463
@ kMove_Verb
Definition SkPath.h:1458

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