1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_LIB_UI_COMPOSITING_SCENE_H_
6#define FLUTTER_LIB_UI_COMPOSITING_SCENE_H_
7
8#include <stdint.h>
9#include <memory>
10
11#include "flutter/flow/layers/layer_tree.h"
12#include "flutter/lib/ui/dart_wrapper.h"
13#include "third_party/skia/include/core/SkPicture.h"
14
15namespace tonic {
16class DartLibraryNatives;
17} // namespace tonic
18
19namespace flutter {
20
21class Scene : public RefCountedDartWrappable<Scene> {
22 DEFINE_WRAPPERTYPEINFO();
23 FML_FRIEND_MAKE_REF_COUNTED(Scene);
24
25 public:
26 ~Scene() override;
27 static void create(Dart_Handle scene_handle,
28 std::shared_ptr<flutter::Layer> rootLayer,
29 uint32_t rasterizerTracingThreshold,
30 bool checkerboardRasterCacheImages,
31 bool checkerboardOffscreenLayers);
32
33 std::unique_ptr<flutter::LayerTree> takeLayerTree();
34
35 Dart_Handle toImage(uint32_t width,
36 uint32_t height,
37 Dart_Handle image_callback);
38
39 void dispose();
40
41 static void RegisterNatives(tonic::DartLibraryNatives* natives);
42
43 private:
44 explicit Scene(std::shared_ptr<flutter::Layer> rootLayer,
45 uint32_t rasterizerTracingThreshold,
46 bool checkerboardRasterCacheImages,
47 bool checkerboardOffscreenLayers);
48
49 std::unique_ptr<flutter::LayerTree> layer_tree_;
50};
51
52} // namespace flutter
53
54#endif // FLUTTER_LIB_UI_COMPOSITING_SCENE_H_
55