• 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_CONTAINER_LAYER_H
9 #define FLUTTER_FLOW_OHOS_LAYERS_CONTAINER_LAYER_H
10 
11 #include <vector>
12 
13 #include "flutter/flow/ohos_layers/layer.h"
14 
15 namespace flutter::OHOS {
16 
17 class ContainerLayer : public Layer {
18 public:
19     ContainerLayer() = default;
20     ~ContainerLayer() override = default;
21 
22     void Add(const std::shared_ptr<Layer>& layer);
23 
GetLayers()24     const std::vector<std::shared_ptr<Layer>>& GetLayers() const
25     {
26         return layers_;
27     }
28 
29     void Prepare(const SkMatrix& matrix) override;
30 
31 protected:
32     void PaintChildren(const PaintContext& paintContext) const;
33 
34     void PrepareChildren(const SkMatrix& childMatrix, SkRect& childPaintBounds);
35 
ClearChildren()36     void ClearChildren()
37     {
38         layers_.clear();
39     }
40 
41 private:
42     std::vector<std::shared_ptr<Layer>> layers_;
43 
44     FML_DISALLOW_COPY_AND_ASSIGN(ContainerLayer);
45 };
46 
47 } // namespace flutter::OHOS
48 
49 #endif // FLUTTER_FLOW_OHOS_LAYERS_CONTAINER_LAYER_H