• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 // 2021.2.10 Increase the process used in native_view mode.
6 //           Copyright (c) 2021 Huawei Device Co., Ltd. All rights reserved.
7 
8 #ifndef FLUTTER_FLOW_OHOS_LAYERS_LAYER_TREE_H
9 #define FLUTTER_FLOW_OHOS_LAYERS_LAYER_TREE_H
10 
11 #include <memory>
12 #include <stdint.h>
13 
14 #include "third_party/skia/include/core/SkPicture.h"
15 #include "third_party/skia/include/core/SkSize.h"
16 
17 #include "flutter/flow/ohos_layers/layer.h"
18 
19 namespace flutter::OHOS {
20 
21 class LayerTree {
22 public:
LayerTree(const std::shared_ptr<Layer> & rootLayer)23     explicit LayerTree(const std::shared_ptr<Layer>& rootLayer) : rootLayer_(rootLayer) {}
24     ~LayerTree() = default;
25 
GetRootLayer()26     std::shared_ptr<Layer> GetRootLayer() const
27     {
28         return rootLayer_;
29     }
30 
GetFrameSize()31     const SkISize& GetFrameSize() const
32     {
33         return treeSize_;
34     }
35 
SetFrameSize(const SkISize & treeSize)36     void SetFrameSize(const SkISize& treeSize)
37     {
38         treeSize_ = treeSize;
39     }
40 
41     void Prepare();
42 
43 private:
44     SkISize treeSize_ { 0, 0 }; // Physical pixels.
45     std::shared_ptr<Layer> rootLayer_;
46 
47     FML_DISALLOW_COPY_AND_ASSIGN(LayerTree);
48 };
49 
50 } // namespace flutter::OHOS
51 
52 #endif // FLUTTER_FLOW_OHOS_LAYERS_LAYER_TREE_H