5#include "flutter/shell/platform/embedder/embedder_layers.h"
12 double device_pixel_ratio,
13 SkMatrix root_surface_transformation,
14 uint64_t presentation_time)
15 : frame_size_(frame_size),
16 device_pixel_ratio_(device_pixel_ratio),
17 root_surface_transformation_(root_surface_transformation),
18 presentation_time_(presentation_time) {}
24 const std::vector<SkIRect>& paint_region_vec) {
31 const auto layer_bounds =
34 const auto transformed_layer_bounds =
35 root_surface_transformation_.
mapRect(layer_bounds);
37 layer.
offset.
x = transformed_layer_bounds.x();
38 layer.
offset.
y = transformed_layer_bounds.y();
39 layer.
size.
width = transformed_layer_bounds.width();
40 layer.
size.
height = transformed_layer_bounds.height();
42 auto paint_region_rects = std::make_unique<std::vector<FlutterRect>>();
43 paint_region_rects->reserve(paint_region_vec.size());
45 for (
const auto&
rect : paint_region_vec) {
46 auto transformed_rect =
51 transformed_rect.
right(),
52 transformed_rect.bottom(),
56 auto paint_region = std::make_unique<FlutterRegion>();
58 paint_region->rects = paint_region_rects->data();
59 paint_region->rects_count = paint_region_rects->size();
60 rects_referenced_.push_back(std::move(paint_region_rects));
62 auto present_info = std::make_unique<FlutterBackingStorePresentInfo>();
64 present_info->paint_region = paint_region.get();
65 regions_referenced_.push_back(std::move(paint_region));
69 present_info_referenced_.push_back(std::move(present_info));
70 presented_layers_.push_back(layer);
78 return std::make_unique<FlutterPlatformViewMutation>(mutation);
89 return std::make_unique<FlutterPlatformViewMutation>(mutation);
94 size.width = vector.
x();
95 size.height = vector.
y();
116 return std::make_unique<FlutterPlatformViewMutation>(mutation);
132 return std::make_unique<FlutterPlatformViewMutation>(mutation);
143 const auto& mutators =
params.mutatorsStack();
145 std::vector<const FlutterPlatformViewMutation*> mutations_array;
147 for (
auto i = mutators.Bottom();
i != mutators.Top(); ++
i) {
148 const auto& mutator = *
i;
149 switch (mutator->GetType()) {
151 mutations_array.push_back(
152 mutations_referenced_
157 mutations_array.push_back(
158 mutations_referenced_
162 case MutatorType::kClipPath: {
165 case MutatorType::kTransform: {
166 const auto&
matrix = mutator->GetMatrix();
167 if (!
matrix.isIdentity()) {
168 mutations_array.push_back(
173 case MutatorType::kOpacity: {
174 const double opacity =
175 std::clamp(mutator->GetAlphaFloat(), 0.0f, 1.0f);
177 mutations_array.push_back(
187 if (!mutations_array.empty()) {
190 if (!root_surface_transformation_.
isIdentity()) {
191 mutations_array.push_back(
192 mutations_referenced_
198 std::make_unique<std::vector<const FlutterPlatformViewMutation*>>(
199 mutations_array.rbegin(), mutations_array.rend());
200 mutations_arrays_referenced_.emplace_back(std::move(mutations));
203 view.
mutations = mutations_arrays_referenced_.back().get()->data();
206 platform_views_referenced_.emplace_back(
207 std::make_unique<FlutterPlatformView>(view));
214 layer.
platform_view = platform_views_referenced_.back().get();
216 const auto layer_bounds =
218 params.finalBoundingRect().y(),
219 params.sizePoints().width() * device_pixel_ratio_,
220 params.sizePoints().height() * device_pixel_ratio_
223 const auto transformed_layer_bounds =
224 root_surface_transformation_.
mapRect(layer_bounds);
226 layer.
offset.
x = transformed_layer_bounds.x();
227 layer.
offset.
y = transformed_layer_bounds.y();
228 layer.
size.
width = transformed_layer_bounds.width();
229 layer.
size.
height = transformed_layer_bounds.height();
233 presented_layers_.push_back(layer);
239 std::vector<const FlutterLayer*> presented_layers_pointers;
240 presented_layers_pointers.reserve(presented_layers_.size());
241 for (
const auto& layer : presented_layers_) {
242 presented_layers_pointers.push_back(&layer);
244 callback(view_id, presented_layers_pointers);
static unsigned clamp(SkFixed fx, int max)
static constexpr int kMScaleX
horizontal scale factor
static constexpr int kMTransY
vertical translation
static constexpr int kMPersp1
input y perspective factor
static constexpr int kMPersp0
input x perspective factor
static constexpr int kMPersp2
perspective bias
static constexpr int kMTransX
horizontal translation
static constexpr int kMSkewY
vertical skew factor
static constexpr int kMScaleY
vertical scale factor
static constexpr int kMSkewX
horizontal skew factor
bool mapRect(SkRect *dst, const SkRect &src, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
const SkRect & rect() const
SkVector radii(Corner corner) const
void PushPlatformViewLayer(FlutterPlatformViewIdentifier identifier, const EmbeddedViewParams ¶ms)
void PushBackingStoreLayer(const FlutterBackingStore *store, const std::vector< SkIRect > &drawn_region)
EmbedderLayers(SkISize frame_size, double device_pixel_ratio, SkMatrix root_surface_transformation, uint64_t presentation_time)
void InvokePresentCallback(FlutterViewId view_id, const PresentCallback &callback) const
std::function< bool(FlutterViewId view_id, const std::vector< const FlutterLayer * > &layers)> PresentCallback
static SkString identifier(const FontFamilyDesc &family, const FontDesc &font)
int64_t FlutterPlatformViewIdentifier
@ kFlutterLayerContentTypePlatformView
Indicates that the contents of this layer are determined by the embedder.
@ kFlutterLayerContentTypeBackingStore
@ kFlutterPlatformViewMutationTypeClipRoundedRect
@ kFlutterPlatformViewMutationTypeClipRect
@ kFlutterPlatformViewMutationTypeTransformation
@ kFlutterPlatformViewMutationTypeOpacity
const EmbeddedViewParams * params
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
unsigned useCenter Optional< SkMatrix > matrix
sk_sp< SkBlender > blender SkRect rect
static FlutterSize VectorToSize(const SkVector &vector)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
static std::unique_ptr< FlutterPlatformViewMutation > ConvertMutation(double opacity)
const myers::Point & get(const myers::Segment &)
FlutterLayerContentType type
const FlutterBackingStore * backing_store
FlutterBackingStorePresentInfo * backing_store_present_info
uint64_t presentation_time
const FlutterPlatformView * platform_view
size_t struct_size
This size of this struct. Must be sizeof(FlutterLayer).
FlutterSize size
The size of the layer (in physical pixels).
A structure to represent a rectangle.
A region represented by a collection of non-overlapping rectangles.
FlutterSize upper_left_corner_radius
FlutterSize lower_left_corner_radius
FlutterSize upper_right_corner_radius
FlutterSize lower_right_corner_radius
A structure to represent the width and height.
constexpr int32_t width() const
constexpr int32_t height() const
constexpr float y() const
constexpr float x() const
static SkRect Make(const SkISize &size)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
static constexpr SkRect MakeWH(float w, float h)