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 #include "flutter/flow/layers/layer.h" 10 11 namespace flutter { 12 13 class ContainerLayer : public Layer { 14 public: 15 ContainerLayer(); 16 ~ContainerLayer() override; 17 18 void Add(std::shared_ptr<Layer> layer); 19 20 void Preroll(PrerollContext* context, const SkMatrix& matrix) override; 21 22 #if defined(OS_FUCHSIA) 23 void UpdateScene(SceneUpdateContext& context) override; 24 #endif // defined(OS_FUCHSIA) 25 layers()26 const std::vector<std::shared_ptr<Layer>>& layers() const { return layers_; } 27 28 protected: 29 void PrerollChildren(PrerollContext* context, 30 const SkMatrix& child_matrix, 31 SkRect* child_paint_bounds); 32 void PaintChildren(PaintContext& context) const; 33 34 #if defined(OS_FUCHSIA) 35 void UpdateSceneChildren(SceneUpdateContext& context); 36 #endif // defined(OS_FUCHSIA) 37 38 // For OpacityLayer to restructure to have a single child. ClearChildren()39 void ClearChildren() { layers_.clear(); } 40 41 private: 42 std::vector<std::shared_ptr<Layer>> layers_; 43 44 FML_DISALLOW_COPY_AND_ASSIGN(ContainerLayer); 45 }; 46 47 } // namespace flutter 48 49 #endif // FLUTTER_FLOW_LAYERS_CONTAINER_LAYER_H_ 50