5#include "flutter/shell/platform/android/android_surface_gl_impeller.h"
7#include "flutter/fml/logging.h"
8#include "flutter/impeller/toolkit/egl/surface.h"
9#include "flutter/shell/gpu/gpu_surface_gl_impeller.h"
14 const std::shared_ptr<AndroidContextGLImpeller>& android_context)
15 : android_context_(android_context) {
16 offscreen_surface_ = android_context_->CreateOffscreenSurface();
18 if (!offscreen_surface_) {
38 auto surface = std::make_unique<GPUSurfaceGLImpeller>(
40 android_context_->GetImpellerContext(),
52 onscreen_surface_.reset();
59 return RecreateOnscreenSurfaceAndMakeOnscreenContextCurrent();
64 if (!offscreen_surface_) {
67 return android_context_->ResourceContextMakeCurrent(offscreen_surface_.get());
72 return android_context_->ResourceContextClearCurrent();
78 native_window_ = std::move(
window);
79 return RecreateOnscreenSurfaceAndMakeOnscreenContextCurrent();
88std::shared_ptr<impeller::Context>
90 return android_context_->GetImpellerContext();
94std::unique_ptr<GLContextResult>
96 return std::make_unique<GLContextDefaultResult>(OnGLContextMakeCurrent());
99bool AndroidSurfaceGLImpeller::OnGLContextMakeCurrent() {
100 if (!onscreen_surface_) {
104 return android_context_->OnscreenContextMakeCurrent(onscreen_surface_.get());
109 if (!onscreen_surface_) {
113 return android_context_->OnscreenContextClearCurrent();
120 info.supports_readback =
true;
121 info.supports_partial_repaint =
false;
127 const std::optional<SkIRect>&
region) {
136 if (!onscreen_surface_) {
139 return onscreen_surface_->Present();
155bool AndroidSurfaceGLImpeller::
156 RecreateOnscreenSurfaceAndMakeOnscreenContextCurrent() {
158 if (!native_window_) {
161 onscreen_surface_.reset();
162 auto onscreen_surface =
163 android_context_->CreateOnscreenSurface(native_window_->handle());
164 if (!onscreen_surface) {
168 onscreen_surface_ = std::move(onscreen_surface);
169 return OnGLContextMakeCurrent();
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
SurfaceFrame::FramebufferInfo GLContextFramebufferInfo() const override
void GLContextSetDamageRegion(const std::optional< SkIRect > ®ion) override
bool ResourceContextMakeCurrent() override
bool ResourceContextClearCurrent() override
void TeardownOnScreenContext() override
bool SetNativeWindow(fml::RefPtr< AndroidNativeWindow > window) override
sk_sp< const GrGLInterface > GetGLInterface() const override
bool GLContextClearCurrent() override
bool GLContextPresent(const GLPresentInfo &present_info) override
bool OnScreenSurfaceResize(const SkISize &size) override
AndroidSurfaceGLImpeller(const std::shared_ptr< AndroidContextGLImpeller > &android_context)
~AndroidSurfaceGLImpeller() override
GLFBOInfo GLContextFBO(GLFrameInfo frame_info) const override
bool IsValid() const override
std::shared_ptr< impeller::Context > GetImpellerContext() override
std::unique_ptr< GLContextResult > GLContextMakeCurrent() override
std::unique_ptr< Surface > CreateSnapshotSurface() override
std::unique_ptr< Surface > CreateGPUSurface(GrDirectContext *gr_context) override
#define FML_DLOG(severity)
#define FML_UNREACHABLE()
ClipOpAndAA opAA SkRegion region
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