Flutter Engine
The Flutter Engine
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.

465 {
470 };
@ kConic
SkPath::RawIter returns 3 points + 1 weight.
@ kConic_Verb
Definition: SkPath.h:1469
@ kCubic_Verb
Definition: SkPath.h:1470
@ kQuad_Verb
Definition: SkPath.h:1468
@ kLine_Verb
Definition: SkPath.h:1467
const SkPoint kQuad[4]

Constructor & Destructor Documentation

◆ SkPathEdgeIter()

SkPathEdgeIter::SkPathEdgeIter ( const SkPath path)

Definition at line 4010 of file SkPath.cpp.

4010 {
4011 fMoveToPtr = fPts = path.fPathRef->points();
4012 fVerbs = path.fPathRef->verbsBegin();
4013 fVerbsStop = path.fPathRef->verbsEnd();
4014 fConicWeights = path.fPathRef->conicWeights();
4015 if (fConicWeights) {
4016 fConicWeights -= 1; // begin one behind
4017 }
4018
4019 fNeedsCloseLine = false;
4020 fNextIsNewContour = false;
4021 SkDEBUGCODE(fIsConic = false;)
4022}
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:1471
@ kMove_Verb
Definition: SkPath.h:1466

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