Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
SubsetVerbs Class Reference

#include <SubsetPath.h>

Inheritance diagram for SubsetVerbs:
SubsetPath

Public Member Functions

 SubsetVerbs (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
 

Additional Inherited Members

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

Detailed Description

Definition at line 59 of file SubsetPath.h.

Constructor & Destructor Documentation

◆ SubsetVerbs()

SubsetVerbs::SubsetVerbs ( const SkPath path)

Definition at line 152 of file SubsetPath.cpp.

153 : SubsetPath(path) {
154 int verbCount = 0;
155 for (auto [verb, pts, w] : SkPathPriv::Iterate(fPath)) {
156 switch (verb) {
158 break;
163 ++verbCount;
164 break;
166 break;
167 default:
168 SkDEBUGFAIL("bad verb");
169 return;
170 }
171 }
172 for (int index = 0; index < verbCount; ++index) {
173 *fSelected.append() = true;
174 }
175 fTries = verbCount;
176}
#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
SkTDArray< bool > fSelected
Definition SubsetPath.h:46
const SkPath & fPath
Definition SubsetPath.h:45
SkScalar w

Member Function Documentation

◆ getSubsetPath()

SkPath SubsetVerbs::getSubsetPath ( ) const
overrideprotectedvirtual

Implements SubsetPath.

Definition at line 178 of file SubsetPath.cpp.

178 {
181 if (!fSelected.size()) {
182 return result;
183 }
184 int verbIndex = 0;
185 bool addMoveTo = true;
186 bool addLineTo = false;
187 for (auto [verb, pts, w] : SkPathPriv::Iterate(fPath)) {
188 bool enabled = SkPathVerb::kLine <= verb && verb <= SkPathVerb::kCubic
189 ? fSelected[verbIndex++] : false;
190 if (enabled) {
191 if (addMoveTo) {
192 result.moveTo(pts[0]);
193 addMoveTo = false;
194 } else if (addLineTo) {
195 result.lineTo(pts[0]);
196 addLineTo = false;
197 }
198 }
199 switch (verb) {
201 break;
203 if (enabled) {
204 result.lineTo(pts[1]);
205 }
206 break;
208 if (enabled) {
209 result.quadTo(pts[1], pts[2]);
210 }
211 break;
213 if (enabled) {
214 result.conicTo(pts[1], pts[2], *w);
215 }
216 break;
218 if (enabled) {
219 result.cubicTo(pts[1], pts[2], pts[3]);
220 }
221 break;
223 result.close();
224 addMoveTo = true;
225 addLineTo = false;
226 continue;
227 default:
228 SkDEBUGFAIL("bad verb");
229 return result;
230 }
231 addLineTo = !enabled;
232 }
233 return result;
234}
SkPathFillType getFillType() const
Definition SkPath.h:230
void setFillType(SkPathFillType ft)
Definition SkPath.h:235
int size() const
Definition SkTDArray.h:138
GAsyncResult * result

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