Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
flutter::DlDashPathEffect Class Referencefinal

#include <dl_path_effect.h>

Inheritance diagram for flutter::DlDashPathEffect:
flutter::DlPathEffect flutter::DlAttribute< DlPathEffect, DlPathEffectType >

Public Member Functions

DlPathEffectType type () const override
 
size_t size () const override
 
std::shared_ptr< DlPathEffectshared () const override
 
const DlDashPathEffectasDash () const override
 
const SkScalarintervals () const
 
int count () const
 
SkScalar phase () const
 
std::optional< SkRecteffect_bounds (SkRect &rect) const override
 
- Public Member Functions inherited from flutter::DlAttribute< DlPathEffect, DlPathEffectType >
bool operator== (DlPathEffect const &other) const
 
bool operator!= (DlPathEffect const &other) const
 
virtual ~DlAttribute ()=default
 

Static Public Member Functions

static std::shared_ptr< DlPathEffectMake (const SkScalar intervals[], int count, SkScalar phase)
 

Protected Member Functions

bool equals_ (DlPathEffect const &other) const override
 
- Protected Member Functions inherited from flutter::DlPathEffect
 DlPathEffect ()=default
 

Friends

class DisplayListBuilder
 
class DlPathEffect
 

Detailed Description

The DashPathEffect which breaks a path up into dash segments, and it only affects stroked paths. intervals: array containing an even number of entries (>=2), with the even indices specifying the length of "on" intervals, and the odd indices specifying the length of "off" intervals. This array will be copied in Make, and can be disposed of freely after. count: number of elements in the intervals array. phase: initial distance into the intervals at which to start the dashing effect for the path.

For example: if intervals[] = {10, 20}, count = 2, and phase = 25, this will set up a dashed path like so: 5 pixels off 10 pixels on 20 pixels off 10 pixels on 20 pixels off ... A phase of -5, 25, 55, 85, etc. would all result in the same path, because the sum of all the intervals is 30.

Definition at line 61 of file dl_path_effect.h.

Member Function Documentation

◆ asDash()

const DlDashPathEffect * flutter::DlDashPathEffect::asDash ( ) const
inlineoverridevirtual

Reimplemented from flutter::DlPathEffect.

Definition at line 76 of file dl_path_effect.h.

76{ return this; }

◆ count()

int flutter::DlDashPathEffect::count ( ) const
inline

Definition at line 81 of file dl_path_effect.h.

81{ return count_; }

◆ effect_bounds()

std::optional< SkRect > flutter::DlDashPathEffect::effect_bounds ( SkRect rect) const
overridevirtual

Implements flutter::DlPathEffect.

Definition at line 30 of file dl_path_effect.cc.

30 {
31 // The dashed path will always be a subset of the original.
32 return rect;
33}
sk_sp< SkBlender > blender SkRect rect
Definition SkRecords.h:350

◆ equals_()

bool flutter::DlDashPathEffect::equals_ ( DlPathEffect const &  other) const
inlineoverrideprotectedvirtual

Implements flutter::DlAttribute< DlPathEffect, DlPathEffectType >.

Definition at line 87 of file dl_path_effect.h.

87 {
88 FML_DCHECK(other.type() == DlPathEffectType::kDash);
89 auto that = static_cast<DlDashPathEffect const*>(&other);
90 return count_ == that->count_ && phase_ == that->phase_ &&
91 memcmp(intervals(), that->intervals(), sizeof(SkScalar) * count_) ==
92 0;
93 }
const SkScalar * intervals() const
float SkScalar
Definition extension.cpp:12
#define FML_DCHECK(condition)
Definition logging.h:103

◆ intervals()

const SkScalar * flutter::DlDashPathEffect::intervals ( ) const
inline

Definition at line 78 of file dl_path_effect.h.

78 {
79 return reinterpret_cast<const SkScalar*>(this + 1);
80 }

◆ Make()

std::shared_ptr< DlPathEffect > flutter::DlDashPathEffect::Make ( const SkScalar  intervals[],
int  count,
SkScalar  phase 
)
static

Definition at line 18 of file dl_path_effect.cc.

20 {
21 size_t needed = sizeof(DlDashPathEffect) + sizeof(SkScalar) * count;
22 void* storage = ::operator new(needed);
23
24 std::shared_ptr<DlDashPathEffect> ret;
25 ret.reset(new (storage) DlDashPathEffect(intervals, count, phase),
27 return std::move(ret);
28}
static void DlPathEffectDeleter(void *p)

◆ phase()

SkScalar flutter::DlDashPathEffect::phase ( ) const
inline

Definition at line 82 of file dl_path_effect.h.

82{ return phase_; }

◆ shared()

std::shared_ptr< DlPathEffect > flutter::DlDashPathEffect::shared ( ) const
inlineoverridevirtual

Implements flutter::DlAttribute< DlPathEffect, DlPathEffectType >.

Definition at line 72 of file dl_path_effect.h.

72 {
73 return Make(intervals(), count_, phase_);
74 }
static std::shared_ptr< DlPathEffect > Make(const SkScalar intervals[], int count, SkScalar phase)

◆ size()

size_t flutter::DlDashPathEffect::size ( ) const
inlineoverridevirtual

Implements flutter::DlAttribute< DlPathEffect, DlPathEffectType >.

Definition at line 68 of file dl_path_effect.h.

68 {
69 return sizeof(*this) + sizeof(SkScalar) * count_;
70 }

◆ type()

DlPathEffectType flutter::DlDashPathEffect::type ( ) const
inlineoverridevirtual

Friends And Related Symbol Documentation

◆ DisplayListBuilder

friend class DisplayListBuilder
friend

Definition at line 117 of file dl_path_effect.h.

◆ DlPathEffect

friend class DlPathEffect
friend

Definition at line 118 of file dl_path_effect.h.


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