Flutter Engine
flutter::Scene Class Reference

#include <scene.h>

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

Public Member Functions

 ~Scene () override
 
std::unique_ptr< flutter::LayerTreetakeLayerTree ()
 
Dart_Handle toImage (uint32_t width, uint32_t height, Dart_Handle image_callback)
 
void dispose ()
 
- Public Member Functions inherited from flutter::RefCountedDartWrappable< Scene >
virtual void RetainDartWrappableReference () const override
 
virtual void ReleaseDartWrappableReference () const override
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< Scene >
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 size_t GetAllocationSize () const
 
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 scene_handle, std::shared_ptr< flutter::Layer > rootLayer, uint32_t rasterizerTracingThreshold, bool checkerboardRasterCacheImages, bool checkerboardOffscreenLayers)
 
static void RegisterNatives (tonic::DartLibraryNatives *natives)
 

Additional Inherited Members

- Public Types inherited from tonic::DartWrappable
enum  DartNativeFields {
  kPeerIndex,
  kWrapperInfoIndex,
  kNumberOfNativeFields
}
 
- Protected Member Functions inherited from fml::RefCountedThreadSafe< Scene >
 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 21 of file scene.h.

Constructor & Destructor Documentation

◆ ~Scene()

flutter::Scene::~Scene ( )
override

Definition at line 62 of file scene.cc.

62 {}

Member Function Documentation

◆ create()

void flutter::Scene::create ( Dart_Handle  scene_handle,
std::shared_ptr< flutter::Layer rootLayer,
uint32_t  rasterizerTracingThreshold,
bool  checkerboardRasterCacheImages,
bool  checkerboardOffscreenLayers 
)
static

Definition at line 30 of file scene.cc.

References tonic::DartWrappable::AssociateWithDartWrapper(), flutter::UIDartState::Current(), flutter::PlatformConfiguration::get_window(), flutter::UIDartState::platform_configuration(), and flutter::Window::viewport_metrics().

Referenced by flutter::SceneBuilder::build().

34  {
35  auto scene = fml::MakeRefCounted<Scene>(
36  std::move(rootLayer), rasterizerTracingThreshold,
37  checkerboardRasterCacheImages, checkerboardOffscreenLayers);
38  scene->AssociateWithDartWrapper(scene_handle);
39 }

◆ dispose()

void flutter::Scene::dispose ( )

Definition at line 64 of file scene.cc.

References tonic::DartWrappable::ClearDartWrapper().

64  {
66 }

◆ RegisterNatives()

static void flutter::Scene::RegisterNatives ( tonic::DartLibraryNatives natives)
static

◆ takeLayerTree()

std::unique_ptr< flutter::LayerTree > flutter::Scene::takeLayerTree ( )

Definition at line 85 of file scene.cc.

Referenced by flutter::RuntimeController::DispatchSemanticsAction().

85  {
86  return std::move(layer_tree_);
87 }

◆ toImage()

Dart_Handle flutter::Scene::toImage ( uint32_t  width,
uint32_t  height,
Dart_Handle  image_callback 
)

Definition at line 68 of file scene.cc.

References flutter::Picture::RasterizeToImage(), tonic::ToDart(), and TRACE_EVENT0.

70  {
71  TRACE_EVENT0("flutter", "Scene::toImage");
72 
73  if (!layer_tree_) {
74  return tonic::ToDart("Scene did not contain a layer tree.");
75  }
76 
77  auto picture = layer_tree_->Flatten(SkRect::MakeWH(width, height));
78  if (!picture) {
79  return tonic::ToDart("Could not flatten scene into a layer tree.");
80  }
81 
82  return Picture::RasterizeToImage(picture, width, height, raw_image_callback);
83 }
#define TRACE_EVENT0(category_group, name)
Definition: trace_event.h:75
int32_t height
int32_t width
Dart_Handle ToDart(const T &object)
static Dart_Handle RasterizeToImage(sk_sp< SkPicture > picture, uint32_t width, uint32_t height, Dart_Handle raw_image_callback)
Definition: picture.cc:68

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