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_CLIP_PATH_LAYER_H_ |
6 | #define FLUTTER_FLOW_LAYERS_CLIP_PATH_LAYER_H_ |
7 | |
8 | #include "flutter/flow/layers/container_layer.h" |
9 | |
10 | namespace flutter { |
11 | |
12 | class ClipPathLayer : public ContainerLayer { |
13 | public: |
14 | ClipPathLayer(const SkPath& clip_path, Clip clip_behavior = Clip::antiAlias); |
15 | |
16 | void Preroll(PrerollContext* context, const SkMatrix& matrix) override; |
17 | |
18 | void Paint(PaintContext& context) const override; |
19 | |
20 | bool UsesSaveLayer() const { |
21 | return clip_behavior_ == Clip::antiAliasWithSaveLayer; |
22 | } |
23 | |
24 | #if defined(LEGACY_FUCHSIA_EMBEDDER) |
25 | void UpdateScene(SceneUpdateContext& context) override; |
26 | #endif |
27 | |
28 | private: |
29 | SkPath clip_path_; |
30 | Clip clip_behavior_; |
31 | bool children_inside_clip_ = false; |
32 | |
33 | FML_DISALLOW_COPY_AND_ASSIGN(ClipPathLayer); |
34 | }; |
35 | |
36 | } // namespace flutter |
37 | |
38 | #endif // FLUTTER_FLOW_LAYERS_CLIP_PATH_LAYER_H_ |
39 |