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 
6 
7 #include <utility>
8 
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
const Matrix & GetTransform() const
Get the global transform matrix for this Entity.
Definition: entity.cc:44
Definition: comparable.h:95
A 4x4 matrix using column-major storage.
Definition: matrix.h:37