Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
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
17
18namespace impeller {
19
20class ContentContext;
21class Entity;
22
23/// Represents a texture and its intended draw transform/sampler configuration.
24struct 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
36
37 /// @brief Whether this snapshot needs to be re-rasterized when used as an
38 /// input to a runtime effect.
39 /// @details This is required because there is no good heuristic to determine
40 /// if a `Snapshot` needs to be rerasterized before applying a RuntimeFilter.
41 /// In particular the GaussianBlurContents will return a Snapshot that
42 /// includes padding for the blur halo which is not possible for the
43 /// RuntimeEffectContents to know about. This value will tell
44 /// RuntimeEffectContents that the Snapshot will have to be rerasterized to
45 /// capture the padding.
47
48 /// Any snapshot that is scaled should rerasterize because we should be
49 /// performing the RuntimeEffect at the resolution of the screen, not the
50 /// scaled up or scaled down version of the snapshot.
55
56 std::optional<Rect> GetCoverage() const;
57
58 /// @brief Get the transform that converts screen space coordinates to the UV
59 /// space of this snapshot.
60 std::optional<Matrix> GetUVTransform() const;
61
62 /// @brief Map a coverage rect to this filter input's UV space.
63 /// Result order: Top left, top right, bottom left, bottom right.
64 std::optional<std::array<Point, 4>> GetCoverageUVs(
65 const Rect& coverage) const;
66};
67
68} // namespace impeller
69
70#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
constexpr bool IsTranslationOnly() const
Returns true if the matrix has no entries other than translation components. Note that an identity ma...
Definition matrix.h:480
Represents a texture and its intended draw transform/sampler configuration.
Definition snapshot.h:24
bool needs_rasterization_for_runtime_effects
Whether this snapshot needs to be re-rasterized when used as an input to a runtime effect.
Definition snapshot.h:46
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
bool ShouldRasterizeForRuntimeEffects() const
Definition snapshot.h:51