Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
flutter::SceneShader Class Reference

#include <scene_shader.h>

Inheritance diagram for flutter::SceneShader:
flutter::Shader flutter::RefCountedDartWrappable< Shader > fml::RefCountedThreadSafe< Shader > tonic::DartWrappable fml::internal::RefCountedThreadSafeBase

Public Member Functions

 ~SceneShader () override
 
void SetCameraTransform (const tonic::Float64List &matrix4)
 
void Dispose ()
 
std::shared_ptr< DlColorSourceshader (DlImageSampling) override
 
- Public Member Functions inherited from flutter::Shader
 ~Shader () override
 
virtual std::shared_ptr< DlColorSourceshader (DlImageSampling)=0
 
- Public Member Functions inherited from flutter::RefCountedDartWrappable< Shader >
virtual void RetainDartWrappableReference () const override
 
virtual void ReleaseDartWrappableReference () const override
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< Shader >
void Release () const
 
- Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase
void AddRef () const
 
bool HasOneRef () const
 
void AssertHasOneRef () const
 
- Public Member Functions inherited from tonic::DartWrappable
 DartWrappable ()
 
virtual const DartWrapperInfoGetDartWrapperInfo () const =0
 
virtual void RetainDartWrappableReference () const =0
 
virtual void ReleaseDartWrappableReference () const =0
 
Dart_Handle CreateDartWrapper (DartState *dart_state)
 
void AssociateWithDartWrapper (Dart_Handle wrappable)
 
void ClearDartWrapper ()
 
Dart_WeakPersistentHandle dart_wrapper () const
 

Static Public Member Functions

static void Create (Dart_Handle wrapper, Dart_Handle scene_node_handle)
 

Additional Inherited Members

- Public Types inherited from tonic::DartWrappable
enum  DartNativeFields { kPeerIndex , kNumberOfNativeFields }
 
- Protected Member Functions inherited from flutter::Shader
 Shader ()
 
- Protected Member Functions inherited from fml::RefCountedThreadSafe< Shader >
 RefCountedThreadSafe ()
 
 ~RefCountedThreadSafe ()
 
- Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase
 RefCountedThreadSafeBase ()
 
 ~RefCountedThreadSafeBase ()
 
bool Release () const
 
void Adopt ()
 
- Protected Member Functions inherited from tonic::DartWrappable
virtual ~DartWrappable ()
 
- Static Protected Member Functions inherited from tonic::DartWrappable
static Dart_PersistentHandle GetTypeForWrapper (tonic::DartState *dart_state, const tonic::DartWrapperInfo &wrapper_info)
 

Detailed Description

Definition at line 20 of file scene_shader.h.

Constructor & Destructor Documentation

◆ ~SceneShader()

flutter::SceneShader::~SceneShader ( )
overridedefault

Member Function Documentation

◆ Create()

void flutter::SceneShader::Create ( Dart_Handle  wrapper,
Dart_Handle  scene_node_handle 
)
static

Definition at line 31 of file scene_shader.cc.

31 {
32 auto* scene_node =
34 if (!scene_node) {
35 return;
36 }
37
38 auto res = fml::MakeRefCounted<SceneShader>(fml::Ref(scene_node));
39 res->AssociateWithDartWrapper(wrapper);
40}
RefPtr< T > Ref(T *ptr)
Definition: ref_ptr.h:237

◆ Dispose()

void flutter::SceneShader::Dispose ( )

Definition at line 90 of file scene_shader.cc.

90 {
91 scene_node_ = nullptr;
93}

◆ SetCameraTransform()

void flutter::SceneShader::SetCameraTransform ( const tonic::Float64List &  matrix4)

Definition at line 42 of file scene_shader.cc.

42 {
43 camera_transform_ =
44 impeller::Matrix(static_cast<impeller::Scalar>(matrix4[0]),
45 static_cast<impeller::Scalar>(matrix4[1]),
46 static_cast<impeller::Scalar>(matrix4[2]),
47 static_cast<impeller::Scalar>(matrix4[3]),
48 static_cast<impeller::Scalar>(matrix4[4]),
49 static_cast<impeller::Scalar>(matrix4[5]),
50 static_cast<impeller::Scalar>(matrix4[6]),
51 static_cast<impeller::Scalar>(matrix4[7]),
52 static_cast<impeller::Scalar>(matrix4[8]),
53 static_cast<impeller::Scalar>(matrix4[9]),
54 static_cast<impeller::Scalar>(matrix4[10]),
55 static_cast<impeller::Scalar>(matrix4[11]),
56 static_cast<impeller::Scalar>(matrix4[12]),
57 static_cast<impeller::Scalar>(matrix4[13]),
58 static_cast<impeller::Scalar>(matrix4[14]),
59 static_cast<impeller::Scalar>(matrix4[15]));
60}
float Scalar
Definition: scalar.h:18
SK_API sk_sp< PrecompileColorFilter > Matrix()

◆ shader()

std::shared_ptr< DlColorSource > flutter::SceneShader::shader ( DlImageSampling  sampling)
overridevirtual

Implements flutter::Shader.

Definition at line 71 of file scene_shader.cc.

71 {
72 FML_CHECK(scene_node_);
73
74 if (!scene_node_->node_) {
75 return nullptr;
76 }
77
78 // TODO(bdero): Gather the mutation log and include it in the scene color
79 // source.
80
81 auto source = std::make_shared<DlSceneColorSource>(
82 scene_node_->node_, camera_transform_.IsIdentity()
84 : camera_transform_);
85 // Just a sanity check, all scene shaders should be thread-safe
86 FML_DCHECK(source->isUIThreadSafe());
87 return source;
88}
SkBitmap source
Definition: examples.cpp:28
#define FML_CHECK(condition)
Definition: logging.h:85
#define FML_DCHECK(condition)
Definition: logging.h:103
static impeller::Matrix DefaultCameraTransform()
Definition: scene_shader.cc:62
constexpr bool IsIdentity() const
Definition: matrix.h:379

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