Flutter Engine
 
Loading...
Searching...
No Matches
android_surface_dynamic_impeller.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
6
7#include <memory>
8
10
11namespace flutter {
12
14 std::shared_ptr<AndroidContextDynamicImpeller>& android_context)
15 : android_context_(android_context) {}
16
18
20 return true;
21}
22
24 if (vulkan_surface_) {
25 vulkan_surface_->TeardownOnScreenContext();
26 } else if (gl_surface_) {
27 gl_surface_->TeardownOnScreenContext();
28 }
29}
30
32 GrDirectContext* gr_context) {
33 if (vulkan_surface_) {
34 if (window_) {
35 vulkan_surface_->SetNativeWindow(window_, jni_facade_);
36 }
37 return vulkan_surface_->CreateGPUSurface(gr_context);
38 }
39 if (gl_surface_) {
40 if (window_) {
41 gl_surface_->SetNativeWindow(window_, jni_facade_);
42 }
43 return gl_surface_->CreateGPUSurface(gr_context);
44 }
45 return nullptr;
46}
47
49 AndroidRenderingAPI api = android_context_->RenderingApi();
51 vulkan_surface_ = std::make_unique<AndroidSurfaceVKImpeller>(
52 android_context_->GetVKContext());
54 gl_surface_ = std::make_unique<AndroidSurfaceGLImpeller>(
55 android_context_->GetGLContext());
56 } else {
58 }
59}
60
62 if (vulkan_surface_) {
63 return vulkan_surface_->OnScreenSurfaceResize(size);
64 }
65 if (gl_surface_) {
66 return gl_surface_->OnScreenSurfaceResize(size);
67 }
68 return false;
69}
70
72 if (vulkan_surface_) {
73 return vulkan_surface_->ResourceContextMakeCurrent();
74 }
75 if (gl_surface_) {
76 return gl_surface_->ResourceContextMakeCurrent();
77 }
78 return false;
79}
80
82 if (vulkan_surface_) {
83 return vulkan_surface_->ResourceContextClearCurrent();
84 }
85 if (gl_surface_) {
86 return gl_surface_->ResourceContextClearCurrent();
87 }
88 return false;
89}
90
93 const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade) {
94 if (vulkan_surface_) {
95 return vulkan_surface_->SetNativeWindow(window, jni_facade);
96 }
97 if (gl_surface_) {
98 return gl_surface_->SetNativeWindow(window, jni_facade);
99 }
100 window_ = window;
101 jni_facade_ = jni_facade;
102 return true;
103}
104
105std::unique_ptr<Surface>
107 if (vulkan_surface_) {
108 return vulkan_surface_->CreateSnapshotSurface();
109 }
110 if (gl_surface_) {
111 return gl_surface_->CreateSnapshotSurface();
112 }
113 return nullptr;
114}
115
116std::shared_ptr<impeller::Context>
118 return android_context_->GetImpellerContext();
119}
120
121} // namespace flutter
bool OnScreenSurfaceResize(const DlISize &size) override
std::unique_ptr< Surface > CreateGPUSurface(GrDirectContext *gr_context) override
bool SetNativeWindow(fml::RefPtr< AndroidNativeWindow > window, const std::shared_ptr< PlatformViewAndroidJNI > &jni_facade) override
AndroidSurfaceDynamicImpeller(std::shared_ptr< AndroidContextDynamicImpeller > &android_context)
std::shared_ptr< impeller::Context > GetImpellerContext() override
std::unique_ptr< Surface > CreateSnapshotSurface() override
GLFWwindow * window
Definition main.cc:60
#define FML_UNREACHABLE()
Definition logging.h:128
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all 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