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 15 namespace tonic { 16 class DartLibraryNatives; 17 } // namespace tonic 18 19 namespace flutter { 20 21 class Scene : public RefCountedDartWrappable<Scene> { 22 DEFINE_WRAPPERTYPEINFO(); 23 FML_FRIEND_MAKE_REF_COUNTED(Scene); 24 25 public: 26 ~Scene() override; 27 static fml::RefPtr<Scene> create(std::shared_ptr<flutter::Layer> rootLayer, 28 uint32_t rasterizerTracingThreshold, 29 bool checkerboardRasterCacheImages, 30 bool checkerboardOffscreenLayers); 31 32 std::unique_ptr<flutter::LayerTree> takeLayerTree(); 33 34 Dart_Handle toImage(uint32_t width, 35 uint32_t height, 36 Dart_Handle image_callback); 37 38 void dispose(); 39 40 static void RegisterNatives(tonic::DartLibraryNatives* natives); 41 42 private: 43 explicit Scene(std::shared_ptr<flutter::Layer> rootLayer, 44 uint32_t rasterizerTracingThreshold, 45 bool checkerboardRasterCacheImages, 46 bool checkerboardOffscreenLayers); 47 48 std::unique_ptr<flutter::LayerTree> m_layerTree; 49 }; 50 51 } // namespace flutter 52 53 #endif // FLUTTER_LIB_UI_COMPOSITING_SCENE_H_ 54