Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
SubsetContours Class Reference

#include <SubsetPath.h>

Inheritance diagram for SubsetContours:
SubsetPath

Public Member Functions

 SubsetContours (const SkPath &path)
 
- Public Member Functions inherited from SubsetPath
 SubsetPath (const SkPath &path)
 
virtual ~SubsetPath ()
 
bool subset (bool testFailed, SkPath *sub)
 

Protected Member Functions

SkPath getSubsetPath () const override
 
- Protected Member Functions inherited from SubsetPath
int range (int *end) const
 
virtual SkPath getSubsetPath () const =0
 

Additional Inherited Members

- Protected Attributes inherited from SubsetPath
const SkPathfPath
 
SkTDArray< bool > fSelected
 
int fSubset
 
int fTries
 

Detailed Description

Definition at line 52 of file SubsetPath.h.

Constructor & Destructor Documentation

◆ SubsetContours()

SubsetContours::SubsetContours ( const SkPath path)

Definition at line 67 of file SubsetPath.cpp.

68 : SubsetPath(path) {
69 bool foundCurve = false;
70 int contourCount = 0;
71 for (auto [verb, pts, w] : SkPathPriv::Iterate(fPath)) {
72 switch (verb) {
74 break;
79 foundCurve = true;
80 break;
82 ++contourCount;
83 foundCurve = false;
84 break;
85 default:
86 SkDEBUGFAIL("bad verb");
87 return;
88 }
89 }
90 contourCount += foundCurve;
91 for (int index = 0; index < contourCount; ++index) {
92 *fSelected.append() = true;
93 }
94 fTries = contourCount;
95}
#define SkDEBUGFAIL(message)
Definition: SkAssert.h:118
@ 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.
T * append()
Definition: SkTDArray.h:191
SubsetPath(const SkPath &path)
Definition: SubsetPath.cpp:16
int fTries
Definition: SubsetPath.h:48
SkTDArray< bool > fSelected
Definition: SubsetPath.h:46
const SkPath & fPath
Definition: SubsetPath.h:45
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
SkScalar w

Member Function Documentation

◆ getSubsetPath()

SkPath SubsetContours::getSubsetPath ( ) const
overrideprotectedvirtual

Implements SubsetPath.

Definition at line 97 of file SubsetPath.cpp.

97 {
99 result.setFillType(fPath.getFillType());
100 if (!fSelected.size()) {
101 return result;
102 }
103 int contourCount = 0;
104 bool enabled = fSelected[0];
105 bool addMoveTo = true;
106 for (auto [verb, pts, w] : SkPathPriv::Iterate(fPath)) {
107 if (enabled && addMoveTo) {
108 result.moveTo(pts[0]);
109 addMoveTo = false;
110 }
111 switch (verb) {
113 break;
115 if (enabled) {
116 result.lineTo(pts[1]);
117 }
118 break;
120 if (enabled) {
121 result.quadTo(pts[1], pts[2]);
122 }
123 break;
125 if (enabled) {
126 result.conicTo(pts[1], pts[2], *w);
127 }
128 break;
130 if (enabled) {
131 result.cubicTo(pts[1], pts[2], pts[3]);
132 }
133 break;
135 if (enabled) {
136 result.close();
137 }
138 if (++contourCount >= fSelected.size()) {
139 break;
140 }
141 enabled = fSelected[contourCount];
142 addMoveTo = true;
143 continue;
144 default:
145 SkDEBUGFAIL("bad verb");
146 return result;
147 }
148 }
149 return result;
150}
Definition: SkPath.h:59
SkPathFillType getFillType() const
Definition: SkPath.h:230
int size() const
Definition: SkTDArray.h:138
GAsyncResult * result

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