Flutter Engine
The Flutter Engine
android_surface_gl_skia.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_ANDROID_ANDROID_SURFACE_GL_SKIA_H_
6#define FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_GL_SKIA_H_
7
8#include <jni.h>
9
10#include <memory>
11
12#include "flutter/fml/macros.h"
13#include "flutter/shell/gpu/gpu_surface_gl_skia.h"
14#include "flutter/shell/platform/android/android_context_gl_skia.h"
15#include "flutter/shell/platform/android/android_environment_gl.h"
16#include "flutter/shell/platform/android/jni/platform_view_android_jni.h"
17#include "flutter/shell/platform/android/surface/android_surface.h"
18
19namespace flutter {
20
22 public AndroidSurface {
23 public:
24 explicit AndroidSurfaceGLSkia(
25 const std::shared_ptr<AndroidContextGLSkia>& android_context);
26
28
29 // |AndroidSurface|
30 bool IsValid() const override;
31
32 // |AndroidSurface|
33 std::unique_ptr<Surface> CreateGPUSurface(
34 GrDirectContext* gr_context) override;
35
36 // |AndroidSurface|
37 void TeardownOnScreenContext() override;
38
39 // |AndroidSurface|
40 bool OnScreenSurfaceResize(const SkISize& size) override;
41
42 // |AndroidSurface|
43 bool ResourceContextMakeCurrent() override;
44
45 // |AndroidSurface|
46 bool ResourceContextClearCurrent() override;
47
48 // |AndroidSurface|
50
51 // |AndroidSurface|
52 virtual std::unique_ptr<Surface> CreateSnapshotSurface() override;
53
54 // |GPUSurfaceGLDelegate|
55 std::unique_ptr<GLContextResult> GLContextMakeCurrent() override;
56
57 // |GPUSurfaceGLDelegate|
58 bool GLContextClearCurrent() override;
59
60 // |GPUSurfaceGLDelegate|
62
63 // |GPUSurfaceGLDelegate|
64 void GLContextSetDamageRegion(const std::optional<SkIRect>& region) override;
65
66 // |GPUSurfaceGLDelegate|
67 bool GLContextPresent(const GLPresentInfo& present_info) override;
68
69 // |GPUSurfaceGLDelegate|
70 GLFBOInfo GLContextFBO(GLFrameInfo frame_info) const override;
71
72 // |GPUSurfaceGLDelegate|
74
75 // Obtain a raw pointer to the on-screen AndroidEGLSurface.
76 //
77 // This method is intended for use in tests. Callers must not
78 // delete the returned pointer.
80 return onscreen_surface_.get();
81 }
82
83 private:
84 std::shared_ptr<AndroidContextGLSkia> android_context_;
86 std::unique_ptr<AndroidEGLSurface> onscreen_surface_;
87 std::unique_ptr<AndroidEGLSurface> offscreen_surface_;
88
89 FML_DISALLOW_COPY_AND_ASSIGN(AndroidSurfaceGLSkia);
90};
91
92} // namespace flutter
93
94#endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_GL_SKIA_H_
AndroidEGLSurface * GetOnscreenSurface() const
bool GLContextPresent(const GLPresentInfo &present_info) override
std::unique_ptr< Surface > CreateGPUSurface(GrDirectContext *gr_context) override
bool OnScreenSurfaceResize(const SkISize &size) override
void GLContextSetDamageRegion(const std::optional< SkIRect > &region) override
virtual std::unique_ptr< Surface > CreateSnapshotSurface() override
sk_sp< const GrGLInterface > GetGLInterface() const override
bool SetNativeWindow(fml::RefPtr< AndroidNativeWindow > window) override
AndroidSurfaceGLSkia(const std::shared_ptr< AndroidContextGLSkia > &android_context)
std::unique_ptr< GLContextResult > GLContextMakeCurrent() override
SurfaceFrame::FramebufferInfo GLContextFramebufferInfo() const override
GLFBOInfo GLContextFBO(GLFrameInfo frame_info) const override
GLFWwindow * window
Definition: main.cc:45
ClipOpAndAA opAA SkRegion region
Definition: SkRecords.h:238
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
Definition: SkSize.h:16