Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
SkPath1DPathEffectImpl Class Reference
Inheritance diagram for SkPath1DPathEffectImpl:
Sk1DPathEffect SkPathEffectBase SkPathEffect SkFlattenable SkRefCnt SkRefCntBase

Public Member Functions

 SkPath1DPathEffectImpl (const SkPath &path, SkScalar advance, SkScalar phase, SkPath1DPathEffect::Style style)
 
bool onFilterPath (SkPath *dst, const SkPath &src, SkStrokeRec *rec, const SkRect *cullRect, const SkMatrix &ctm) const override
 
SkScalar begin (SkScalar contourLength) const override
 
SkScalar next (SkPath *, SkScalar, SkPathMeasure &) const override
 
void flatten (SkWriteBuffer &buffer) const override
 
Factory getFactory () const override
 
const char * getTypeName () const override
 
- Public Member Functions inherited from SkPathEffectBase
 SkPathEffectBase ()
 
bool asPoints (PointData *results, const SkPath &src, const SkStrokeRec &, const SkMatrix &, const SkRect *cullR) const
 
SkFlattenable::Type getFlattenableType () const override
 
virtual bool onNeedsCTM () const
 
virtual bool onAsPoints (PointData *, const SkPath &, const SkStrokeRec &, const SkMatrix &, const SkRect *) const
 
virtual DashType onAsADash (DashInfo *) const
 
- Public Member Functions inherited from SkPathEffect
DashType asADash (DashInfo *info) const
 
bool filterPath (SkPath *dst, const SkPath &src, SkStrokeRec *, const SkRect *cullR) const
 
bool filterPath (SkPath *dst, const SkPath &src, SkStrokeRec *, const SkRect *cullR, const SkMatrix &ctm) const
 
bool needsCTM () const
 
- Public Member Functions inherited from SkFlattenable
 SkFlattenable ()
 
sk_sp< SkDataserialize (const SkSerialProcs *=nullptr) const
 
size_t serialize (void *memory, size_t memory_size, const SkSerialProcs *=nullptr) const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Static Public Member Functions

static sk_sp< SkFlattenableCreateProc (SkReadBuffer &buffer)
 
- Static Public Member Functions inherited from SkPathEffectBase
static sk_sp< SkPathEffectDeserialize (const void *data, size_t size, const SkDeserialProcs *procs=nullptr)
 
static void RegisterFlattenables ()
 
- Static Public Member Functions inherited from SkPathEffect
static sk_sp< SkPathEffectMakeSum (sk_sp< SkPathEffect > first, sk_sp< SkPathEffect > second)
 
static sk_sp< SkPathEffectMakeCompose (sk_sp< SkPathEffect > outer, sk_sp< SkPathEffect > inner)
 
static SkFlattenable::Type GetFlattenableType ()
 
static sk_sp< SkPathEffectDeserialize (const void *data, size_t size, const SkDeserialProcs *procs=nullptr)
 
- Static Public Member Functions inherited from SkFlattenable
static Factory NameToFactory (const char name[])
 
static const char * FactoryToName (Factory)
 
static void Register (const char name[], Factory)
 
static sk_sp< SkFlattenableDeserialize (Type, const void *data, size_t length, const SkDeserialProcs *procs=nullptr)
 

Additional Inherited Members

- Public Types inherited from SkPathEffect
enum  DashType { kNone_DashType , kDash_DashType }
 
- Public Types inherited from SkFlattenable
enum  Type {
  kSkColorFilter_Type , kSkBlender_Type , kSkDrawable_Type , kSkDrawLooper_Type ,
  kSkImageFilter_Type , kSkMaskFilter_Type , kSkPathEffect_Type , kSkShader_Type
}
 
typedef sk_sp< SkFlattenable >(* Factory) (SkReadBuffer &)
 

Detailed Description

Definition at line 73 of file Sk1DPathEffect.cpp.

Constructor & Destructor Documentation

◆ SkPath1DPathEffectImpl()

SkPath1DPathEffectImpl::SkPath1DPathEffectImpl ( const SkPath path,
SkScalar  advance,
SkScalar  phase,
SkPath1DPathEffect::Style  style 
)
inline

Definition at line 75 of file Sk1DPathEffect.cpp.

76 : fPath(path) {
77 SkASSERT(advance > 0 && !path.isEmpty());
78
79 // Make the path thread-safe.
80 fPath.updateBoundsCache();
81 (void)fPath.getGenerationID();
82
83 // cleanup their phase parameter, inverting it so that it becomes an
84 // offset along the path (to match the interpretation in PostScript)
85 if (phase < 0) {
86 phase = -phase;
87 if (phase > advance) {
88 phase = SkScalarMod(phase, advance);
89 }
90 } else {
91 if (phase > advance) {
92 phase = SkScalarMod(phase, advance);
93 }
94 phase = advance - phase;
95 }
96 // now catch the edge case where phase == advance (within epsilon)
97 if (phase >= advance) {
98 phase = 0;
99 }
100 SkASSERT(phase >= 0);
101
102 fAdvance = advance;
103 fInitialOffset = phase;
104 fStyle = style;
105 }
#define SkASSERT(cond)
Definition SkAssert.h:116
#define SkScalarMod(x, y)
Definition SkScalar.h:41
uint32_t getGenerationID() const
Definition SkPath.cpp:356
void updateBoundsCache() const
Definition SkPath.h:524
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

◆ begin()

SkScalar SkPath1DPathEffectImpl::begin ( SkScalar  contourLength) const
inlineoverridevirtual

Called at the start of each contour, returns the initial offset into that contour.

Implements Sk1DPathEffect.

Definition at line 113 of file Sk1DPathEffect.cpp.

113 {
114 return fInitialOffset;
115 }

◆ CreateProc()

static sk_sp< SkFlattenable > SkPath1DPathEffectImpl::CreateProc ( SkReadBuffer buffer)
inlinestatic

Definition at line 119 of file Sk1DPathEffect.cpp.

119 {
120 SkScalar advance = buffer.readScalar();
121 SkPath path;
122 buffer.readPath(&path);
123 SkScalar phase = buffer.readScalar();
125 return buffer.isValid() ? SkPath1DPathEffect::Make(path, advance, phase, style) : nullptr;
126 }
static sk_sp< SkPathEffect > Make(const SkPath &path, SkScalar advance, SkScalar phase, Style)
float SkScalar
Definition extension.cpp:12
static const uint8_t buffer[]

◆ flatten()

void SkPath1DPathEffectImpl::flatten ( SkWriteBuffer ) const
inlineoverridevirtual

Override this if your subclass needs to record data that it will need to recreate itself from its CreateProc (returned by getFactory()).

DEPRECATED public : will move to protected ... use serialize() instead

Reimplemented from SkFlattenable.

Definition at line 128 of file Sk1DPathEffect.cpp.

128 {
129 buffer.writeScalar(fAdvance);
130 buffer.writePath(fPath);
131 buffer.writeScalar(fInitialOffset);
132 buffer.writeUInt(fStyle);
133 }

◆ getFactory()

Factory SkPath1DPathEffectImpl::getFactory ( ) const
inlineoverridevirtual

Implement this to return a factory function pointer that can be called to recreate your class given a buffer (previously written to by your override of flatten().

Implements SkFlattenable.

Definition at line 135 of file Sk1DPathEffect.cpp.

135{ return CreateProc; }
static sk_sp< SkFlattenable > CreateProc(SkReadBuffer &buffer)

◆ getTypeName()

const char * SkPath1DPathEffectImpl::getTypeName ( ) const
inlineoverridevirtual

Returns the name of the object's class.

Implements SkFlattenable.

Definition at line 136 of file Sk1DPathEffect.cpp.

136{ return "SkPath1DPathEffect"; }

◆ next()

SkScalar SkPath1DPathEffectImpl::next ( SkPath dst,
SkScalar  dist,
SkPathMeasure  
) const
overridevirtual

Called with the current distance along the path, with the current matrix for the point/tangent at the specified distance. Return the distance to travel for the next call. If return <= 0, then that contour is done.

Implements Sk1DPathEffect.

Definition at line 221 of file Sk1DPathEffect.cpp.

222 {
223#if defined(SK_BUILD_FOR_FUZZER)
224 if (dst->countPoints() > 100000) {
225 return fAdvance;
226 }
227#endif
228 switch (fStyle) {
230 SkPoint pos;
231 if (meas.getPosTan(distance, &pos, nullptr)) {
232 dst->addPath(fPath, pos.fX, pos.fY);
233 }
234 } break;
237 if (meas.getMatrix(distance, &matrix)) {
238 dst->addPath(fPath, matrix);
239 }
240 } break;
242 morphpath(dst, fPath, meas, distance);
243 break;
244 }
245 return fAdvance;
246}
SkPoint pos
static void morphpath(SkPath *dst, const SkPath &src, SkPathMeasure &meas, SkScalar dist)
unsigned useCenter Optional< SkMatrix > matrix
Definition SkRecords.h:258
dst
Definition cp.py:12
float fX
x-axis value
float fY
y-axis value

◆ onFilterPath()

bool SkPath1DPathEffectImpl::onFilterPath ( SkPath ,
const SkPath ,
SkStrokeRec ,
const SkRect ,
const SkMatrix  
) const
inlineoverridevirtual

Filter the input path.

The CTM parameter is provided for path effects that can use the information. The output of path effects must always be in the original (input) coordinate system, regardless of whether the path effect uses the CTM or not.

Reimplemented from Sk1DPathEffect.

Definition at line 107 of file Sk1DPathEffect.cpp.

108 {
109 rec->setFillStyle();
110 return this->INHERITED::onFilterPath(dst, src, rec, cullRect, ctm);
111 }
bool onFilterPath(SkPath *dst, const SkPath &src, SkStrokeRec *, const SkRect *, const SkMatrix &) const override

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