| Flutter Impeller |

texture_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/texture_filter_input.h"
6
7 #include <utility>
8
9 #include "impeller/core/formats.h"
10
11 namespace impeller {
12
13 TextureFilterInput::TextureFilterInput(std::shared_ptr<Texture> texture,
14 Matrix local_transform)
15 : texture_(std::move(texture)), local_transform_(local_transform) {}
16
17 TextureFilterInput::~TextureFilterInput() = default;
18
19 std::optional<Snapshot> TextureFilterInput::GetSnapshot(
20 std::string_view label,
21 const ContentContext& renderer,
22 const Entity& entity,
23 std::optional<Rect> coverage_limit,
24 int32_t mip_count) const {
25 auto snapshot =
26 Snapshot{.texture = texture_, .transform = GetTransform(entity)};
27 if (texture_->GetMipCount() > 1) {
28 snapshot.sampler_descriptor.label = "TextureFilterInput Trilinear Sampler";
29 snapshot.sampler_descriptor.mip_filter = MipFilter::kLinear;
30 }
31 return snapshot;
32 }
33
34 std::optional<Rect> TextureFilterInput::GetCoverage(
35 const Entity& entity) const {
36 return Rect::MakeSize(texture_->GetSize())
37 .TransformBounds(GetTransform(entity));
38 }
39
40 Matrix TextureFilterInput::GetLocalTransform(const Entity& entity) const {
41 return local_transform_;
42 }
43
44 } // namespace impeller
impeller::ContentContext
Definition: content_context.h:371
impeller::Entity
Definition: entity.h:20
formats.h
impeller
Definition: allocation.cc:12
std
Definition: comparable.h:95
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::Snapshot
Represents a texture and its intended draw transform/sampler configuration.
Definition: snapshot.h:24
impeller::Snapshot::texture
std::shared_ptr< Texture > texture
Definition: snapshot.h:25
texture_filter_input.h