Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
filter_contents_filter_input.cc
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
6
7#include <utility>
8
11
12namespace impeller {
13
14FilterContentsFilterInput::FilterContentsFilterInput(
15 std::shared_ptr<FilterContents> filter)
16 : filter_(std::move(filter)) {}
17
18FilterContentsFilterInput::~FilterContentsFilterInput() = default;
19
20FilterInput::Variant FilterContentsFilterInput::GetInput() const {
21 return filter_;
22}
23
24std::optional<Snapshot> FilterContentsFilterInput::GetSnapshot(
25 const std::string& label,
26 const ContentContext& renderer,
27 const Entity& entity,
28 std::optional<Rect> coverage_limit,
29 int32_t mip_count) const {
30 if (!snapshot_.has_value()) {
31 snapshot_ = filter_->RenderToSnapshot(
32 renderer, // renderer
33 entity, // entity
34 coverage_limit, // coverage_limit
35 std::nullopt, // sampler_descriptor
36 true, // msaa_enabled
37 /*mip_count=*/mip_count,
38 SPrintF("Filter to %s Filter Snapshot", label.c_str())); // label
39 }
40 return snapshot_;
41}
42
43std::optional<Rect> FilterContentsFilterInput::GetCoverage(
44 const Entity& entity) const {
45 return filter_->GetCoverage(entity);
46}
47
48std::optional<Rect> FilterContentsFilterInput::GetSourceCoverage(
49 const Matrix& effect_transform,
50 const Rect& output_limit) const {
51 return filter_->GetSourceCoverage(effect_transform, output_limit);
52}
53
54Matrix FilterContentsFilterInput::GetLocalTransform(
55 const Entity& entity) const {
56 return filter_->GetLocalTransform(entity.GetTransform());
57}
58
59Matrix FilterContentsFilterInput::GetTransform(const Entity& entity) const {
60 return filter_->GetTransform(entity.GetTransform());
61}
62
63void FilterContentsFilterInput::PopulateGlyphAtlas(
64 const std::shared_ptr<LazyGlyphAtlas>& lazy_glyph_atlas,
65 Scalar scale) {
66 filter_->PopulateGlyphAtlas(lazy_glyph_atlas, scale);
67}
68
69bool FilterContentsFilterInput::IsTranslationOnly() const {
70 return filter_->IsTranslationOnly();
71}
72
73bool FilterContentsFilterInput::IsLeaf() const {
74 return false;
75}
76
77void FilterContentsFilterInput::SetLeafInputs(
78 const FilterInput::Vector& inputs) {
79 filter_->SetLeafInputs(inputs);
80}
81
82void FilterContentsFilterInput::SetEffectTransform(const Matrix& matrix) {
83 filter_->SetEffectTransform(matrix);
84}
85
86void FilterContentsFilterInput::SetRenderingMode(
87 Entity::RenderingMode rendering_mode) {
88 filter_->SetRenderingMode(rendering_mode);
89}
90
91} // namespace impeller
const Matrix & GetTransform() const
Get the global transform matrix for this Entity.
Definition entity.cc:46
std::variant< std::shared_ptr< FilterContents >, std::shared_ptr< Contents >, std::shared_ptr< Texture >, Rect > Variant
std::vector< FilterInput::Ref > Vector
float Scalar
Definition scalar.h:18
std::string SPrintF(const char *format,...)
Definition strings.cc:12
Definition ref_ptr.h:256
const Scalar scale
A 4x4 matrix using column-major storage.
Definition matrix.h:37