Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Member Functions | Friends | List of all members
Sk2DPathEffect Class Reference
Inheritance diagram for Sk2DPathEffect:
SkPathEffectBase SkPathEffect SkFlattenable SkRefCnt SkRefCntBase SkLine2DPathEffectImpl SkPath2DPathEffectImpl

Public Member Functions

 Sk2DPathEffect (const SkMatrix &mat)
 
- 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 ()
 
virtual Factory getFactory () const =0
 
virtual const char * getTypeName () const =0
 
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
 

Protected Member Functions

virtual void begin (const SkIRect &uvBounds, SkPath *dst) const
 
virtual void next (const SkPoint &loc, int u, int v, SkPath *dst) const
 
virtual void end (SkPath *dst) const
 
virtual void nextSpan (int x, int y, int ucount, SkPath *path) const
 
const SkMatrixgetMatrix () const
 
void flatten (SkWriteBuffer &buffer) const override
 
bool onFilterPath (SkPath *dst, const SkPath &src, SkStrokeRec *rec, const SkRect *cullRect, const SkMatrix &) const override
 

Private Member Functions

bool computeFastBounds (SkRect *) const override
 

Friends

class Sk2DPathEffectBlitter
 

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 &)
 
- 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)
 

Detailed Description

Definition at line 25 of file Sk2DPathEffect.cpp.

Constructor & Destructor Documentation

◆ Sk2DPathEffect()

Sk2DPathEffect::Sk2DPathEffect ( const SkMatrix mat)
inline

Definition at line 27 of file Sk2DPathEffect.cpp.

27 : fMatrix(mat) {
28 // Calling invert will set the type mask on both matrices, making them thread safe.
29 fMatrixIsInvertible = fMatrix.invert(&fInverse);
30 }
bool invert(SkMatrix *inverse) const
Definition SkMatrix.h:1206

Member Function Documentation

◆ begin()

virtual void Sk2DPathEffect::begin ( const SkIRect uvBounds,
SkPath dst 
) const
inlineprotectedvirtual

New virtual, to be overridden by subclasses. This is called once from filterPath, and provides the uv parameter bounds for the path. Subsequent calls to next() will receive u and v values within these bounds, and then a call to end() will signal the end of processing.

Definition at line 39 of file Sk2DPathEffect.cpp.

39{}

◆ computeFastBounds()

bool Sk2DPathEffect::computeFastBounds ( SkRect ) const
inlineoverrideprivatevirtual

Implements SkPathEffectBase.

Definition at line 113 of file Sk2DPathEffect.cpp.

113{ return false; }

◆ end()

virtual void Sk2DPathEffect::end ( SkPath dst) const
inlineprotectedvirtual

Definition at line 41 of file Sk2DPathEffect.cpp.

41{}

◆ flatten()

void Sk2DPathEffect::flatten ( SkWriteBuffer ) const
inlineoverrideprotectedvirtual

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.

Reimplemented in SkLine2DPathEffectImpl, and SkPath2DPathEffectImpl.

Definition at line 70 of file Sk2DPathEffect.cpp.

70 {
71 buffer.writeMatrix(fMatrix);
72 }
static const uint8_t buffer[]

◆ getMatrix()

const SkMatrix & Sk2DPathEffect::getMatrix ( ) const
inlineprotected

Definition at line 68 of file Sk2DPathEffect.cpp.

68{ return fMatrix; }

◆ next()

virtual void Sk2DPathEffect::next ( const SkPoint loc,
int  u,
int  v,
SkPath dst 
) const
inlineprotectedvirtual

Reimplemented in SkPath2DPathEffectImpl.

Definition at line 40 of file Sk2DPathEffect.cpp.

40{}

◆ nextSpan()

virtual void Sk2DPathEffect::nextSpan ( int  x,
int  y,
int  ucount,
SkPath path 
) const
inlineprotectedvirtual

Low-level virtual called per span of locations in the u-direction. The default implementation calls next() repeatedly with each location.

Reimplemented in SkLine2DPathEffectImpl.

Definition at line 47 of file Sk2DPathEffect.cpp.

47 {
48 if (!fMatrixIsInvertible) {
49 return;
50 }
51 #if defined(SK_BUILD_FOR_FUZZER)
52 if (ucount > 100) {
53 return;
54 }
55 #endif
56
57 const SkMatrix& mat = this->getMatrix();
59
61 do {
62 mat.mapPoints(&dst, &src, 1);
63 this->next(dst, x++, y, path);
64 src.fX += SK_Scalar1;
65 } while (--ucount > 0);
66 }
#define SK_Scalar1
Definition SkScalar.h:18
#define SK_ScalarHalf
Definition SkScalar.h:19
#define SkIntToScalar(x)
Definition SkScalar.h:57
virtual void next(const SkPoint &loc, int u, int v, SkPath *dst) const
const SkMatrix & getMatrix() const
void mapPoints(SkPoint dst[], const SkPoint src[], int count) const
Definition SkMatrix.cpp:770
double y
double x
dst
Definition cp.py:12

◆ onFilterPath()

bool Sk2DPathEffect::onFilterPath ( SkPath ,
const SkPath ,
SkStrokeRec ,
const SkRect ,
const SkMatrix  
) const
inlineoverrideprotectedvirtual

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.

Implements SkPathEffectBase.

Reimplemented in SkLine2DPathEffectImpl.

Definition at line 74 of file Sk2DPathEffect.cpp.

75 {
76 if (!fMatrixIsInvertible) {
77 return false;
78 }
79
80 SkPath tmp;
81 SkIRect ir;
82
83 src.transform(fInverse, &tmp);
84 tmp.getBounds().round(&ir);
85 if (!ir.isEmpty()) {
86 this->begin(ir, dst);
87
88 SkRegion rgn;
89 rgn.setPath(tmp, SkRegion(ir));
90 SkRegion::Iterator iter(rgn);
91 for (; !iter.done(); iter.next()) {
92 const SkIRect& rect = iter.rect();
93#if defined(SK_BUILD_FOR_FUZZER)
94 if (rect.height() > 100) {
95 continue;
96 }
97#endif
98 for (int y = rect.fTop; y < rect.fBottom; ++y) {
99 this->nextSpan(rect.fLeft, y, rect.width(), dst);
100 }
101 }
102
103 this->end(dst);
104 }
105 return true;
106 }
virtual void begin(const SkIRect &uvBounds, SkPath *dst) const
virtual void nextSpan(int x, int y, int ucount, SkPath *path) const
const SkRect & getBounds() const
Definition SkPath.cpp:420
bool setPath(const SkPath &path, const SkRegion &clip)
glong glong end
sk_sp< SkBlender > blender SkRect rect
Definition SkRecords.h:350
bool isEmpty() const
Definition SkRect.h:202
int32_t fLeft
smaller x-axis bounds
Definition SkRect.h:33
void round(SkIRect *dst) const
Definition SkRect.h:1228

Friends And Related Symbol Documentation

◆ Sk2DPathEffectBlitter

friend class Sk2DPathEffectBlitter
friend

Definition at line 115 of file Sk2DPathEffect.cpp.


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