Flutter Impeller
local_matrix_filter_contents.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 namespace impeller {
8 
10 
12 
14  matrix_ = matrix;
15 }
16 
18  const Matrix& parent_transform) const {
19  return matrix_;
20 }
21 
23  const Matrix& effect_transform,
24  const Rect& output_limit) const {
25  auto matrix = matrix_.Basis();
26  if (matrix.GetDeterminant() == 0.0) {
27  return std::nullopt;
28  }
29  auto inverse = matrix.Invert();
30  return output_limit.TransformBounds(inverse);
31 }
32 
33 std::optional<Entity> LocalMatrixFilterContents::RenderFilter(
34  const FilterInput::Vector& inputs,
35  const ContentContext& renderer,
36  const Entity& entity,
37  const Matrix& effect_transform,
38  const Rect& coverage,
39  const std::optional<Rect>& coverage_hint) const {
40  std::optional<Snapshot> snapshot =
41  inputs[0]->GetSnapshot("LocalMatrix", renderer, entity);
42  if (!snapshot.has_value()) {
43  return std::nullopt;
44  }
45  return Entity::FromSnapshot(snapshot.value(), entity.GetBlendMode(),
46  entity.GetClipDepth());
47 }
48 
49 } // namespace impeller
impeller::TRect::TransformBounds
constexpr TRect TransformBounds(const Matrix &transform) const
Creates a new bounding box that contains this transformed rectangle.
Definition: rect.h:405
impeller::Entity::FromSnapshot
static Entity FromSnapshot(const Snapshot &snapshot, BlendMode blend_mode=BlendMode::kSourceOver, uint32_t clip_depth=0)
Create an entity that can be used to render a given snapshot.
Definition: entity.cc:22
impeller::LocalMatrixFilterContents::LocalMatrixFilterContents
LocalMatrixFilterContents()
local_matrix_filter_contents.h
impeller::Entity
Definition: entity.h:21
impeller::Matrix::Basis
constexpr Matrix Basis() const
The Matrix without its w components (without translation).
Definition: matrix.h:224
impeller::LocalMatrixFilterContents::GetFilterSourceCoverage
std::optional< Rect > GetFilterSourceCoverage(const Matrix &effect_transform, const Rect &output_limit) const override
Internal utility method for |GetSourceCoverage| that computes the inverse effect of this transform on...
Definition: local_matrix_filter_contents.cc:22
impeller::LocalMatrixFilterContents::GetLocalTransform
Matrix GetLocalTransform(const Matrix &parent_transform) const override
Definition: local_matrix_filter_contents.cc:17
impeller::Entity::GetBlendMode
BlendMode GetBlendMode() const
Definition: entity.cc:134
impeller::Matrix::Invert
Matrix Invert() const
Definition: matrix.cc:97
impeller::LocalMatrixFilterContents::SetMatrix
void SetMatrix(Matrix matrix)
Definition: local_matrix_filter_contents.cc:13
impeller::Entity::GetClipDepth
uint32_t GetClipDepth() const
Definition: entity.cc:105
impeller::LocalMatrixFilterContents::~LocalMatrixFilterContents
~LocalMatrixFilterContents() override
impeller::FilterInput::Vector
std::vector< FilterInput::Ref > Vector
Definition: filter_input.h:33
impeller
Definition: aiks_blur_unittests.cc:20
impeller::ContentContext
Definition: content_context.h:392
impeller::TRect< Scalar >
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37