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_FLOW_LAYERS_CONTAINER_LAYER_H_ |
6 | #define FLUTTER_FLOW_LAYERS_CONTAINER_LAYER_H_ |
7 | |
8 | #include <vector> |
9 | |
10 | #include "flutter/flow/layers/layer.h" |
11 | |
12 | namespace flutter { |
13 | |
14 | class ContainerLayer : public Layer { |
15 | public: |
16 | ContainerLayer(); |
17 | |
18 | void Diff(DiffContext* context, const Layer* old_layer) override; |
19 | void PreservePaintRegion(DiffContext* context) override; |
20 | |
21 | virtual void Add(std::shared_ptr<Layer> layer); |
22 | |
23 | void Preroll(PrerollContext* context) override; |
24 | void Paint(PaintContext& context) const override; |
25 | |
26 | const std::vector<std::shared_ptr<Layer>>& layers() const { return layers_; } |
27 | |
28 | virtual void DiffChildren(DiffContext* context, |
29 | const ContainerLayer* old_layer); |
30 | |
31 | void PaintChildren(PaintContext& context) const override; |
32 | |
33 | const ContainerLayer* as_container_layer() const override { return this; } |
34 | |
35 | const SkRect& child_paint_bounds() const { return child_paint_bounds_; } |
36 | void set_child_paint_bounds(const SkRect& bounds) { |
37 | child_paint_bounds_ = bounds; |
38 | } |
39 | |
40 | int children_renderable_state_flags() const { |
41 | return children_renderable_state_flags_; |
42 | } |
43 | void set_children_renderable_state_flags(int flags) { |
44 | children_renderable_state_flags_ = flags; |
45 | } |
46 | |
47 | protected: |
48 | void PrerollChildren(PrerollContext* context, SkRect* child_paint_bounds); |
49 | |
50 | private: |
51 | std::vector<std::shared_ptr<Layer>> layers_; |
52 | SkRect child_paint_bounds_; |
53 | int children_renderable_state_flags_ = 0; |
54 | |
55 | FML_DISALLOW_COPY_AND_ASSIGN(ContainerLayer); |
56 | }; |
57 | |
58 | } // namespace flutter |
59 | |
60 | #endif // FLUTTER_FLOW_LAYERS_CONTAINER_LAYER_H_ |
61 |