Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
7namespace 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
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}
47
48} // namespace impeller
static Entity FromSnapshot(const Snapshot &snapshot, BlendMode blend_mode=BlendMode::kSourceOver)
Create an entity that can be used to render a given snapshot.
Definition entity.cc:22
BlendMode GetBlendMode() const
Definition entity.cc:119
std::vector< FilterInput::Ref > Vector
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...
Matrix GetLocalTransform(const Matrix &parent_transform) const override
std::optional< Entity > RenderFilter(const FilterInput::Vector &input_textures, const ContentContext &renderer, const Entity &entity, const Matrix &effect_transform, const Rect &coverage, const std::optional< Rect > &coverage_hint) const override
Converts zero or more filter inputs into a render instruction.
A 4x4 matrix using column-major storage.
Definition matrix.h:37
constexpr Matrix Basis() const
The Matrix without its w components (without translation).
Definition matrix.h:229
constexpr TRect TransformBounds(const Matrix &transform) const
Creates a new bounding box that contains this transformed rectangle.
Definition rect.h:440