| Flutter Impeller |

paint_pass_delegate.h
Go to the documentation of this file.
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_IMPELLER_AIKS_PAINT_PASS_DELEGATE_H_
6 #define FLUTTER_IMPELLER_AIKS_PAINT_PASS_DELEGATE_H_
7
8 #include <optional>
9
10 #include "flutter/fml/macros.h"
11 #include "impeller/aiks/paint.h"
12 #include "impeller/entity/entity_pass_delegate.h"
13
14 namespace impeller {
15
16 class PaintPassDelegate final : public EntityPassDelegate {
17 public:
18 explicit PaintPassDelegate(Paint paint);
19
20 // |EntityPassDelgate|
21 ~PaintPassDelegate() override;
22
23 // |EntityPassDelgate|
24 bool CanElide() override;
25
26 // |EntityPassDelgate|
27 bool CanCollapseIntoParentPass(EntityPass* entity_pass) override;
28
29 // |EntityPassDelgate|
30 std::shared_ptr<Contents> CreateContentsForSubpassTarget(
31 std::shared_ptr<Texture> target,
32 const Matrix& effect_transform) override;
33
34 // |EntityPassDelgate|
35 std::shared_ptr<FilterContents> WithImageFilter(
36 const FilterInput::Variant& input,
37 const Matrix& effect_transform) const override;
38
39 private:
40 const Paint paint_;
41
42 PaintPassDelegate(const PaintPassDelegate&) = delete;
43
44 PaintPassDelegate& operator=(const PaintPassDelegate&) = delete;
45 };
46
47 /// A delegate that attempts to forward opacity from a save layer to
48 /// child contents.
49 ///
50 /// Currently this has a hardcoded limit of 3 entities in a pass, and
51 /// cannot forward to child subpass delegates.
52 class OpacityPeepholePassDelegate final : public EntityPassDelegate {
53 public:
54 explicit OpacityPeepholePassDelegate(Paint paint);
55
56 // |EntityPassDelgate|
57 ~OpacityPeepholePassDelegate() override;
58
59 // |EntityPassDelgate|
60 bool CanElide() override;
61
62 // |EntityPassDelgate|
63 bool CanCollapseIntoParentPass(EntityPass* entity_pass) override;
64
65 // |EntityPassDelgate|
66 std::shared_ptr<Contents> CreateContentsForSubpassTarget(
67 std::shared_ptr<Texture> target,
68 const Matrix& effect_transform) override;
69
70 // |EntityPassDelgate|
71 std::shared_ptr<FilterContents> WithImageFilter(
72 const FilterInput::Variant& input,
73 const Matrix& effect_transform) const override;
74
75 private:
76 const Paint paint_;
77
78 OpacityPeepholePassDelegate(const OpacityPeepholePassDelegate&) = delete;
79
80 OpacityPeepholePassDelegate& operator=(const OpacityPeepholePassDelegate&) =
81 delete;
82 };
83
84 } // namespace impeller
85
86 #endif // FLUTTER_IMPELLER_AIKS_PAINT_PASS_DELEGATE_H_
impeller::PaintPassDelegate::CreateContentsForSubpassTarget
std::shared_ptr< Contents > CreateContentsForSubpassTarget(std::shared_ptr< Texture > target, const Matrix &effect_transform) override
Definition: paint_pass_delegate.cc:35
entity_pass_delegate.h
impeller::Paint
Definition: paint.h:22
impeller::EntityPassDelegate
Definition: entity_pass_delegate.h:20
impeller::OpacityPeepholePassDelegate
Definition: paint_pass_delegate.h:52
impeller::EntityPass
Definition: entity_pass.h:26
impeller::PaintPassDelegate::CanCollapseIntoParentPass
bool CanCollapseIntoParentPass(EntityPass *entity_pass) override
Whether or not this entity pass can be collapsed into the parent. If true, this method may modify the...
Definition: paint_pass_delegate.cc:30
impeller::OpacityPeepholePassDelegate::OpacityPeepholePassDelegate
OpacityPeepholePassDelegate(Paint paint)
Definition: paint_pass_delegate.cc:60
impeller::FilterInput::Variant
std::variant< std::shared_ptr< FilterContents >, std::shared_ptr< Contents >, std::shared_ptr< Texture >, Rect > Variant
Definition: filter_input.h:37
impeller::OpacityPeepholePassDelegate::CanCollapseIntoParentPass
bool CanCollapseIntoParentPass(EntityPass *entity_pass) override
Whether or not this entity pass can be collapsed into the parent. If true, this method may modify the...
Definition: paint_pass_delegate.cc:72
impeller::PaintPassDelegate
Definition: paint_pass_delegate.h:16
impeller::PaintPassDelegate::PaintPassDelegate
PaintPassDelegate(Paint paint)
Definition: paint_pass_delegate.cc:19
impeller::OpacityPeepholePassDelegate::~OpacityPeepholePassDelegate
~OpacityPeepholePassDelegate() override
impeller::PaintPassDelegate::WithImageFilter
std::shared_ptr< FilterContents > WithImageFilter(const FilterInput::Variant &input, const Matrix &effect_transform) const override
Definition: paint_pass_delegate.cc:50
impeller::PaintPassDelegate::~PaintPassDelegate
~PaintPassDelegate() override
paint.h
impeller::OpacityPeepholePassDelegate::CreateContentsForSubpassTarget
std::shared_ptr< Contents > CreateContentsForSubpassTarget(std::shared_ptr< Texture > target, const Matrix &effect_transform) override
Definition: paint_pass_delegate.cc:136
impeller::OpacityPeepholePassDelegate::WithImageFilter
std::shared_ptr< FilterContents > WithImageFilter(const FilterInput::Variant &input, const Matrix &effect_transform) const override
Definition: paint_pass_delegate.cc:151
impeller::PaintPassDelegate::CanElide
bool CanElide() override
Definition: paint_pass_delegate.cc:25
impeller
Definition: aiks_context.cc:10
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::OpacityPeepholePassDelegate::CanElide
bool CanElide() override
Definition: paint_pass_delegate.cc:67