| Flutter Impeller |

snapshot.h
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 #ifndef FLUTTER_IMPELLER_RENDERER_SNAPSHOT_H_
6 #define FLUTTER_IMPELLER_RENDERER_SNAPSHOT_H_
7
8 #include <functional>
9 #include <memory>
10 #include <vector>
11
12 #include "flutter/fml/macros.h"
13 #include "impeller/core/formats.h"
14 #include "impeller/core/sampler_descriptor.h"
15 #include "impeller/core/texture.h"
16 #include "impeller/geometry/matrix.h"
17 #include "impeller/geometry/rect.h"
18
19 namespace impeller {
20
21 class ContentContext;
22 class Entity;
23
24 /// Represents a texture and its intended draw transform/sampler configuration.
25 struct Snapshot {
26 std::shared_ptr<Texture> texture;
27 /// The transform that should be applied to this texture for rendering.
28 Matrix transform;
29
30 SamplerDescriptor sampler_descriptor =
31 SamplerDescriptor("Default Snapshot Sampler",
32 MinMagFilter::kLinear,
33 MinMagFilter::kLinear,
34 MipFilter::kNearest);
35
36 Scalar opacity = 1.0f;
37
38 std::optional<Rect> GetCoverage() const;
39
40 /// @brief Get the transform that converts screen space coordinates to the UV
41 /// space of this snapshot.
42 std::optional<Matrix> GetUVTransform() const;
43
44 /// @brief Map a coverage rect to this filter input's UV space.
45 /// Result order: Top left, top right, bottom left, bottom right.
46 std::optional<std::array<Point, 4>> GetCoverageUVs(
47 const Rect& coverage) const;
48 };
49
50 } // namespace impeller
51
52 #endif // FLUTTER_IMPELLER_RENDERER_SNAPSHOT_H_
impeller::Scalar
float Scalar
Definition: scalar.h:18
formats.h
impeller::Snapshot::sampler_descriptor
SamplerDescriptor sampler_descriptor
Definition: snapshot.h:30
impeller::SamplerDescriptor
Definition: sampler_descriptor.h:15
matrix.h
impeller::MipFilter::kNearest
@ kNearest
Sample from the nearest mip level.
impeller::Snapshot::GetCoverage
std::optional< Rect > GetCoverage() const
Definition: snapshot.cc:11
impeller::Snapshot::transform
Matrix transform
The transform that should be applied to this texture for rendering.
Definition: snapshot.h:28
impeller::MinMagFilter::kLinear
@ kLinear
impeller::Snapshot
Represents a texture and its intended draw transform/sampler configuration.
Definition: snapshot.h:25
impeller::Snapshot::GetUVTransform
std::optional< Matrix > GetUVTransform() const
Get the transform that converts screen space coordinates to the UV space of this snapshot.
Definition: snapshot.cc:18
sampler_descriptor.h
rect.h
texture.h
impeller::Snapshot::texture
std::shared_ptr< Texture > texture
Definition: snapshot.h:26
impeller::Snapshot::GetCoverageUVs
std::optional< std::array< Point, 4 > > GetCoverageUVs(const Rect &coverage) const
Map a coverage rect to this filter input's UV space. Result order: Top left, top right,...
Definition: snapshot.cc:26
impeller
Definition: aiks_context.cc:10
impeller::TRect< Scalar >
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::Snapshot::opacity
Scalar opacity
Definition: snapshot.h:36