| 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, // renderer
28 entity, // entity
29 coverage_limit, // coverage_limit
30 std::nullopt, // sampler_descriptor
31 true, // msaa_enabled
32 /*mip_count=*/mip_count, //
33 label); // label
34 }
35 return snapshot_;
36 }
37
38 std::optional<Rect> FilterContentsFilterInput::GetCoverage(
39 const Entity& entity) const {
40 return filter_->GetCoverage(entity);
41 }
42
43 std::optional<Rect> FilterContentsFilterInput::GetSourceCoverage(
44 const Matrix& effect_transform,
45 const Rect& output_limit) const {
46 return filter_->GetSourceCoverage(effect_transform, output_limit);
47 }
48
49 Matrix FilterContentsFilterInput::GetLocalTransform(
50 const Entity& entity) const {
51 return filter_->GetLocalTransform(entity.GetTransform());
52 }
53
54 Matrix FilterContentsFilterInput::GetTransform(const Entity& entity) const {
55 return filter_->GetTransform(entity.GetTransform());
56 }
57
58 void FilterContentsFilterInput::SetEffectTransform(const Matrix& matrix) {
59 filter_->SetEffectTransform(matrix);
60 }
61
62 void FilterContentsFilterInput::SetRenderingMode(
63 Entity::RenderingMode rendering_mode) {
64 filter_->SetRenderingMode(rendering_mode);
65 }
66
67 } // 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:44
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 >