// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef FLUTTER_LIB_UI_COMPOSITING_SCENE_BUILDER_H_ #define FLUTTER_LIB_UI_COMPOSITING_SCENE_BUILDER_H_ #include #include #include #include "flutter/flow/layers/container_layer.h" #include "flutter/lib/ui/compositing/scene.h" #include "flutter/lib/ui/compositing/scene_host.h" #include "flutter/lib/ui/painting/image_filter.h" #include "flutter/lib/ui/painting/path.h" #include "flutter/lib/ui/painting/picture.h" #include "flutter/lib/ui/painting/rrect.h" #include "flutter/lib/ui/painting/shader.h" #include "lib/tonic/dart_wrappable.h" #include "lib/tonic/typed_data/float64_list.h" namespace blink { class SceneBuilder : public ftl::RefCountedThreadSafe, public tonic::DartWrappable { DEFINE_WRAPPERTYPEINFO(); FRIEND_MAKE_REF_COUNTED(SceneBuilder); public: static ftl::RefPtr create() { return ftl::MakeRefCounted(); } ~SceneBuilder() override; void pushTransform(const tonic::Float64List& matrix4); void pushClipRect(double left, double right, double top, double bottom); void pushClipRRect(const RRect& rrect); void pushClipPath(const CanvasPath* path); void pushOpacity(int alpha); void pushColorFilter(int color, int blendMode); void pushBackdropFilter(ImageFilter* filter); void pushShaderMask(Shader* shader, double maskRectLeft, double maskRectRight, double maskRectTop, double maskRectBottom, int blendMode); void pushPhysicalModel(const RRect& rrect, double elevation, int color); void pop(); void addPerformanceOverlay(uint64_t enabledOptions, double left, double right, double top, double bottom); void addPicture(double dx, double dy, Picture* picture, int hints); void addChildScene(double dx, double dy, double width, double height, SceneHost* sceneHost, bool hitTestable); void setRasterizerTracingThreshold(uint32_t frameInterval); void setCheckerboardRasterCacheImages(bool checkerboard); void setCheckerboardOffscreenLayers(bool checkerboard); ftl::RefPtr build(); static void RegisterNatives(tonic::DartLibraryNatives* natives); private: SceneBuilder(); void addLayer(std::unique_ptr layer, const SkRect& cullRect); std::unique_ptr m_rootLayer; flow::ContainerLayer* m_currentLayer; int32_t m_currentRasterizerTracingThreshold; bool m_checkerboardRasterCacheImages; bool m_checkerboardOffscreenLayers; std::stack m_cullRects; }; } // namespace blink #endif // FLUTTER_LIB_UI_COMPOSITING_SCENE_BUILDER_H_