Flutter Engine
The Flutter Engine
platform_view_layer.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 "flutter/flow/layers/platform_view_layer.h"
6
7#include "flutter/display_list/skia/dl_sk_canvas.h"
8
9namespace flutter {
10
12 const SkSize& size,
13 int64_t view_id)
14 : offset_(offset), size_(size), view_id_(view_id) {}
15
17 set_paint_bounds(SkRect::MakeXYWH(offset_.x(), offset_.y(), size_.width(),
18 size_.height()));
19
20 if (context->view_embedder == nullptr) {
21 FML_DLOG(ERROR) << "Trying to embed a platform view but the PrerollContext "
22 "does not support embedding";
23 return;
24 }
25 context->has_platform_view = true;
27 MutatorsStack mutators;
28 context->state_stack.fill(&mutators);
29 std::unique_ptr<EmbeddedViewParams> params =
30 std::make_unique<EmbeddedViewParams>(context->state_stack.transform_3x3(),
31 size_, mutators);
33 std::move(params));
34 context->view_embedder->PushVisitedPlatformView(view_id_);
35}
36
38 if (context.view_embedder == nullptr) {
39 FML_DLOG(ERROR) << "Trying to embed a platform view but the PaintContext "
40 "does not support embedding";
41 return;
42 }
43 DlCanvas* canvas = context.view_embedder->CompositeEmbeddedView(view_id_);
44 context.canvas = canvas;
45 context.state_stack.set_delegate(canvas);
46 context.rendering_above_platform_view = true;
47}
48
49} // namespace flutter
Developer-facing API for rendering anything within the engine.
Definition: dl_canvas.h:38
virtual void PrerollCompositeEmbeddedView(int64_t platform_view_id, std::unique_ptr< EmbeddedViewParams > params)=0
virtual void PushVisitedPlatformView(int64_t platform_view_id)
virtual DlCanvas * CompositeEmbeddedView(int64_t platform_view_id)=0
SkMatrix transform_3x3() const
void fill(MutatorsStack *mutators)
void set_delegate(DlCanvas *canvas)
void set_subtree_has_platform_view(bool value)
Definition: layer.h:202
void set_paint_bounds(const SkRect &paint_bounds)
Definition: layer.h:223
void Preroll(PrerollContext *context) override
PlatformViewLayer(const SkPoint &offset, const SkSize &size, int64_t view_id)
void Paint(PaintContext &context) const override
const EmbeddedViewParams * params
#define FML_DLOG(severity)
Definition: logging.h:102
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
Definition: switches.h:259
SeparatedVector2 offset
constexpr float y() const
Definition: SkPoint_impl.h:187
constexpr float x() const
Definition: SkPoint_impl.h:181
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659
Definition: SkSize.h:52
SkScalar width() const
Definition: SkSize.h:76
SkScalar height() const
Definition: SkSize.h:77
ExternalViewEmbedder * view_embedder
Definition: layer.h:111
bool rendering_above_platform_view
Definition: layer.h:107
DlCanvas * canvas
Definition: layer.h:102
LayerStateStack & state_stack
Definition: layer.h:101
LayerStateStack & state_stack
Definition: layer.h:59
ExternalViewEmbedder * view_embedder
Definition: layer.h:58
#define ERROR(message)
Definition: elf_loader.cc:260