Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
embedder_external_view.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_SHELL_PLATFORM_EMBEDDER_EMBEDDER_EXTERNAL_VIEW_H_
6#define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_EXTERNAL_VIEW_H_
7
8#include <optional>
9#include <unordered_map>
10#include <unordered_set>
11
14#include "flutter/fml/macros.h"
16
17namespace flutter {
18
20 public:
21 using PlatformViewID = int64_t;
23 std::optional<PlatformViewID> platform_view_id;
24
26
29
30 struct Hash {
31 constexpr std::size_t operator()(const ViewIdentifier& desc) const {
32 if (!desc.platform_view_id.has_value()) {
33 return fml::HashCombine();
34 }
35
36 return fml::HashCombine(desc.platform_view_id.value());
37 }
38 };
39
40 struct Equal {
41 constexpr bool operator()(const ViewIdentifier& lhs,
42 const ViewIdentifier& rhs) const {
43 return lhs.platform_view_id == rhs.platform_view_id;
44 }
45 };
46 };
47
50
51 explicit RenderTargetDescriptor(const DlISize& p_surface_size)
52 : surface_size(p_surface_size) {}
53
54 struct Hash {
55 constexpr std::size_t operator()(
56 const RenderTargetDescriptor& desc) const {
58 desc.surface_size.height);
59 }
60 };
61
62 struct Equal {
64 const RenderTargetDescriptor& rhs) const {
65 return lhs.surface_size == rhs.surface_size;
66 }
67 };
68 };
69
70 using ViewIdentifierSet = std::unordered_set<ViewIdentifier,
73
74 using PendingViews = std::unordered_map<ViewIdentifier,
75 std::unique_ptr<EmbedderExternalView>,
78
79 EmbedderExternalView(const DlISize& frame_size,
80 const DlMatrix& surface_transformation);
81
82 EmbedderExternalView(const DlISize& frame_size,
83 const DlMatrix& surface_transformation,
85 std::unique_ptr<EmbeddedViewParams> params);
86
88
89 bool IsRootView() const;
90
91 bool HasPlatformView() const;
92
94
96
98
100
102
104
105 void Render(DlCanvas& dl_canvas, bool clear_surface);
106
107 const DlRegion& GetDlRegion() const;
108
109 private:
110 // End the recording of the slice.
111 // Noop if the slice's recording has already ended.
112 void TryEndRecording() const;
113
114 const DlISize render_surface_size_;
115 const DlMatrix surface_transformation_;
116 ViewIdentifier view_identifier_;
117 std::unique_ptr<EmbeddedViewParams> embedded_view_params_;
118 std::unique_ptr<DisplayListEmbedderViewSlice> slice_;
119 std::optional<bool> has_engine_rendered_contents_;
120
122};
123
124} // namespace flutter
125
126#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_EXTERNAL_VIEW_H_
Developer-facing API for rendering anything within the engine.
Definition dl_canvas.h:32
const EmbeddedViewParams * GetEmbeddedViewParams() const
void Render(DlCanvas &dl_canvas, bool clear_surface)
RenderTargetDescriptor CreateRenderTargetDescriptor() const
std::unordered_set< ViewIdentifier, ViewIdentifier::Hash, ViewIdentifier::Equal > ViewIdentifierSet
const DlRegion & GetDlRegion() const
ViewIdentifier GetViewIdentifier() const
std::unordered_map< ViewIdentifier, std::unique_ptr< EmbedderExternalView >, ViewIdentifier::Hash, ViewIdentifier::Equal > PendingViews
EmbedderExternalView::ViewIdentifier view_identifier
const EmbeddedViewParams * params
G_BEGIN_DECLS FlutterViewId view_id
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
constexpr std::size_t HashCombine()
bool operator()(const RenderTargetDescriptor &lhs, const RenderTargetDescriptor &rhs) const
constexpr std::size_t operator()(const RenderTargetDescriptor &desc) const
constexpr bool operator()(const ViewIdentifier &lhs, const ViewIdentifier &rhs) const
constexpr std::size_t operator()(const ViewIdentifier &desc) const
A 4x4 matrix using column-major storage.
Definition matrix.h:37
Type height
Definition size.h:29
Type width
Definition size.h:28