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