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