Flutter Engine
 
Loading...
Searching...
No Matches
flutter::DlRuntimeEffectColorSource Class Referencefinal

#include <dl_runtime_effect_color_source.h>

Inheritance diagram for flutter::DlRuntimeEffectColorSource:
flutter::DlColorSource flutter::DlAttribute< DlColorSource, DlColorSourceType >

Public Member Functions

 DlRuntimeEffectColorSource (sk_sp< DlRuntimeEffect > runtime_effect, std::vector< std::shared_ptr< DlColorSource > > samplers, std::shared_ptr< std::vector< uint8_t > > uniform_data)
 
bool isUIThreadSafe () const override
 If the underlying platform data held by this object is held in a way that it can be stored and potentially released from the UI thread, this method returns true.
 
const DlRuntimeEffectColorSourceasRuntimeEffect () const override
 
std::shared_ptr< DlColorSourceshared () const override
 
DlColorSourceType type () const override
 
size_t size () const override
 
bool is_opaque () const override
 
const sk_sp< DlRuntimeEffectruntime_effect () const
 
const std::vector< std::shared_ptr< DlColorSource > > samplers () const
 
const std::shared_ptr< std::vector< uint8_t > > uniform_data () const
 
- Public Member Functions inherited from flutter::DlColorSource
virtual bool isGradient () const
 If the underlying platform data represents a gradient.
 
virtual const DlImageColorSourceasImage () const
 
virtual const DlLinearGradientColorSourceasLinearGradient () const
 
virtual const DlRadialGradientColorSourceasRadialGradient () const
 
virtual const DlConicalGradientColorSourceasConicalGradient () const
 
virtual const DlSweepGradientColorSourceasSweepGradient () const
 
- Public Member Functions inherited from flutter::DlAttribute< DlColorSource, DlColorSourceType >
bool operator== (DlColorSource const &other) const
 
bool operator!= (DlColorSource const &other) const
 
virtual ~DlAttribute ()=default
 

Protected Member Functions

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

Additional Inherited Members

- Static Public Member Functions inherited from flutter::DlColorSource
static std::shared_ptr< DlColorSourceMakeImage (const sk_sp< const DlImage > &image, DlTileMode horizontal_tile_mode, DlTileMode vertical_tile_mode, DlImageSampling sampling=DlImageSampling::kLinear, const DlMatrix *matrix=nullptr)
 
static std::shared_ptr< DlColorSourceMakeLinear (const DlPoint start_point, const DlPoint end_point, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
 
static std::shared_ptr< DlColorSourceMakeLinear (const DlPoint start_point, const DlPoint end_point, uint32_t stop_count, const DlScalar *colors_argb, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
 Make a linear gradient.
 
static std::shared_ptr< DlColorSourceMakeRadial (DlPoint center, DlScalar radius, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
 
static std::shared_ptr< DlColorSourceMakeRadial (DlPoint center, DlScalar radius, uint32_t stop_count, const DlScalar *colors_argb, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
 Make a radial gradient.
 
static std::shared_ptr< DlColorSourceMakeConical (DlPoint start_center, DlScalar start_radius, DlPoint end_center, DlScalar end_radius, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
 
static std::shared_ptr< DlColorSourceMakeConical (DlPoint start_center, DlScalar start_radius, DlPoint end_center, DlScalar end_radius, uint32_t stop_count, const DlScalar *colors_argb, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
 Make a conical gradient.
 
static std::shared_ptr< DlColorSourceMakeSweep (DlPoint center, DlScalar start, DlScalar end, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
 
static std::shared_ptr< DlColorSourceMakeSweep (DlPoint center, DlScalar start, DlScalar end, uint32_t stop_count, const DlScalar *colors_argb, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
 Make a sweep gradient.
 
static std::shared_ptr< DlColorSourceMakeRuntimeEffect (sk_sp< DlRuntimeEffect > runtime_effect, std::vector< std::shared_ptr< DlColorSource > > samplers, std::shared_ptr< std::vector< uint8_t > > uniform_data)
 

Detailed Description

Definition at line 12 of file dl_runtime_effect_color_source.h.

Constructor & Destructor Documentation

◆ DlRuntimeEffectColorSource()

flutter::DlRuntimeEffectColorSource::DlRuntimeEffectColorSource ( sk_sp< DlRuntimeEffect runtime_effect,
std::vector< std::shared_ptr< DlColorSource > >  samplers,
std::shared_ptr< std::vector< uint8_t > >  uniform_data 
)

Definition at line 9 of file dl_runtime_effect_color_source.cc.

13 : runtime_effect_(std::move(runtime_effect)),
14 samplers_(std::move(samplers)),
15 uniform_data_(std::move(uniform_data)) {}
const std::shared_ptr< std::vector< uint8_t > > uniform_data() const
const sk_sp< DlRuntimeEffect > runtime_effect() const
const std::vector< std::shared_ptr< DlColorSource > > samplers() const

Member Function Documentation

◆ asRuntimeEffect()

const DlRuntimeEffectColorSource * flutter::DlRuntimeEffectColorSource::asRuntimeEffect ( ) const
inlineoverridevirtual

Reimplemented from flutter::DlColorSource.

Definition at line 21 of file dl_runtime_effect_color_source.h.

21 {
22 return this;
23 }

◆ equals_()

bool flutter::DlRuntimeEffectColorSource::equals_ ( DlColorSource const &  other) const
overrideprotectedvirtual

Implements flutter::DlAttribute< DlColorSource, DlColorSourceType >.

Definition at line 32 of file dl_runtime_effect_color_source.cc.

32 {
34 auto that = static_cast<DlRuntimeEffectColorSource const*>(&other);
35 if (runtime_effect_ != that->runtime_effect_) {
36 return false;
37 }
38 if (uniform_data_ != that->uniform_data_) {
39 return false;
40 }
41 if (samplers_.size() != that->samplers_.size()) {
42 return false;
43 }
44 for (size_t i = 0; i < samplers_.size(); i++) {
45 if (samplers_[i] != that->samplers_[i]) {
46 return false;
47 }
48 }
49 return true;
50}
DlRuntimeEffectColorSource(sk_sp< DlRuntimeEffect > runtime_effect, std::vector< std::shared_ptr< DlColorSource > > samplers, std::shared_ptr< std::vector< uint8_t > > uniform_data)
#define FML_DCHECK(condition)
Definition logging.h:122

References FML_DCHECK, i, flutter::kRuntimeEffect, and flutter::DlAttribute< D, T >::type().

◆ is_opaque()

bool flutter::DlRuntimeEffectColorSource::is_opaque ( ) const
inlineoverridevirtual

Implements flutter::DlColorSource.

Definition at line 32 of file dl_runtime_effect_color_source.h.

32{ return false; }

◆ isUIThreadSafe()

bool flutter::DlRuntimeEffectColorSource::isUIThreadSafe ( ) const
overridevirtual

If the underlying platform data held by this object is held in a way that it can be stored and potentially released from the UI thread, this method returns true.

Returns
True if the class has no GPU related resources or if any that it holds are held in a thread-safe manner.

Implements flutter::DlColorSource.

Definition at line 23 of file dl_runtime_effect_color_source.cc.

23 {
24 for (const auto& sampler : samplers_) {
25 if (!sampler->isUIThreadSafe()) {
26 return false;
27 }
28 }
29 return true;
30}

◆ runtime_effect()

const sk_sp< DlRuntimeEffect > flutter::DlRuntimeEffectColorSource::runtime_effect ( ) const
inline

Definition at line 34 of file dl_runtime_effect_color_source.h.

34 {
35 return runtime_effect_;
36 }

Referenced by impeller::Paint::CreateContents(), and flutter::ToSk().

◆ samplers()

const std::vector< std::shared_ptr< DlColorSource > > flutter::DlRuntimeEffectColorSource::samplers ( ) const
inline

Definition at line 37 of file dl_runtime_effect_color_source.h.

37 {
38 return samplers_;
39 }

Referenced by impeller::Paint::CreateContents(), and flutter::ToSk().

◆ shared()

std::shared_ptr< DlColorSource > flutter::DlRuntimeEffectColorSource::shared ( ) const
overridevirtual

Implements flutter::DlAttribute< DlColorSource, DlColorSourceType >.

Definition at line 17 of file dl_runtime_effect_color_source.cc.

17 {
18 return std::make_shared<DlRuntimeEffectColorSource>(runtime_effect_, //
19 samplers_, //
20 uniform_data_);
21}

◆ size()

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

Implements flutter::DlAttribute< DlColorSource, DlColorSourceType >.

Definition at line 30 of file dl_runtime_effect_color_source.h.

30{ return sizeof(*this); }

◆ type()

DlColorSourceType flutter::DlRuntimeEffectColorSource::type ( ) const
inlineoverridevirtual

◆ uniform_data()

const std::shared_ptr< std::vector< uint8_t > > flutter::DlRuntimeEffectColorSource::uniform_data ( ) const
inline

Definition at line 40 of file dl_runtime_effect_color_source.h.

40 {
41 return uniform_data_;
42 }

Referenced by impeller::Paint::CreateContents(), and flutter::ToSk().


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