| Flutter Impeller |

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
5 #include "impeller/entity/contents/filters/inputs/filter_contents_filter_input.h"
6
7 #include <utility>
8
9 #include "impeller/base/strings.h"
10 #include "impeller/entity/contents/filters/filter_contents.h"
11
12 namespace impeller {
13
14 FilterContentsFilterInput::FilterContentsFilterInput(
15 std::shared_ptr<FilterContents> filter)
16 : filter_(std::move(filter)) {}
17
18 FilterContentsFilterInput::~FilterContentsFilterInput() = default;
19
20 std::optional<Snapshot> FilterContentsFilterInput::GetSnapshot(
21 std::string_view label,
22 const ContentContext& renderer,
23 const Entity& entity,
24 std::optional<Rect> coverage_limit,
25 int32_t mip_count) const {
26 if (!snapshot_.has_value()) {
27 snapshot_ = filter_->RenderToSnapshot(renderer, entity,
28 {.coverage_limit = coverage_limit,
29 .sampler_descriptor = std::nullopt,
30 .msaa_enabled = true,
31 .mip_count = mip_count,
32 .label = label});
33 }
34 return snapshot_;
35 }
36
37 std::optional<Rect> FilterContentsFilterInput::GetCoverage(
38 const Entity& entity) const {
39 return filter_->GetCoverage(entity);
40 }
41
42 std::optional<Rect> FilterContentsFilterInput::GetSourceCoverage(
43 const Matrix& effect_transform,
44 const Rect& output_limit) const {
45 return filter_->GetSourceCoverage(effect_transform, output_limit);
46 }
47
48 Matrix FilterContentsFilterInput::GetLocalTransform(
49 const Entity& entity) const {
50 return filter_->GetLocalTransform(entity.GetTransform());
51 }
52
53 Matrix FilterContentsFilterInput::GetTransform(const Entity& entity) const {
54 return filter_->GetTransform(entity.GetTransform());
55 }
56
57 void FilterContentsFilterInput::SetEffectTransform(const Matrix& matrix) {
58 filter_->SetEffectTransform(matrix);
59 }
60
61 void FilterContentsFilterInput::SetRenderingMode(
62 Entity::RenderingMode rendering_mode) {
63 filter_->SetRenderingMode(rendering_mode);
64 }
65
66 } // namespace impeller
impeller::ContentContext
Definition: content_context.h:138
impeller::Entity
Definition: entity.h:26
impeller::Entity::RenderingMode
RenderingMode
Definition: entity.h:33
impeller::Entity::GetTransform
const Matrix & GetTransform() const
Get the global transform matrix for this Entity.
Definition: entity.cc:46
filter_contents.h
filter_contents_filter_input.h
impeller
Definition: allocation.cc:12
std
Definition: comparable.h:95
strings.h
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::TRect< Scalar >