Flutter Engine
 
Loading...
Searching...
No Matches
android_context_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_CONTEXT_GL_SKIA_H_
6#define FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_CONTEXT_GL_SKIA_H_
7
15#include "third_party/skia/include/core/SkSize.h"
16
17namespace flutter {
18
19class AndroidEGLSurface;
20
21//------------------------------------------------------------------------------
22/// The Android context is used by `AndroidSurfaceGL` to create and manage
23/// EGL surfaces.
24///
25/// This context binds `EGLContext` to the current rendering thread and to the
26/// draw and read `EGLSurface`s.
27///
29 public:
31 const TaskRunners& taskRunners);
32
34
35 //----------------------------------------------------------------------------
36 /// @brief Allocates an new EGL window surface that is used for on-screen
37 /// pixels.
38 ///
39 /// @return The window surface.
40 ///
41 std::unique_ptr<AndroidEGLSurface> CreateOnscreenSurface(
43
44 //----------------------------------------------------------------------------
45 /// @brief Allocates an 1x1 pbuffer surface that is used for making the
46 /// offscreen current for texture uploads.
47 ///
48 /// @return The pbuffer surface.
49 ///
50 std::unique_ptr<AndroidEGLSurface> CreateOffscreenSurface() const;
51
52 //----------------------------------------------------------------------------
53 /// @brief Allocates an 1x1 pbuffer surface that is used for making the
54 /// onscreen context current for snapshotting.
55 ///
56 /// @return The pbuffer surface.
57 ///
58 std::unique_ptr<AndroidEGLSurface> CreatePbufferSurface() const;
59
60 //----------------------------------------------------------------------------
61 /// @return The Android environment that contains a reference to the
62 /// display.
63 ///
65
66 //----------------------------------------------------------------------------
67 /// @return Whether the current context is valid. That is, if the EGL
68 /// contexts were successfully created.
69 ///
70 bool IsValid() const override;
71
72 //----------------------------------------------------------------------------
73 /// @return Whether the current context was successfully clear.
74 ///
75 bool ClearCurrent() const;
76
77 //----------------------------------------------------------------------------
78 /// @brief Returns the EGLContext.
79 ///
80 /// @return EGLContext.
81 ///
82 EGLContext GetEGLContext() const;
83
84 //----------------------------------------------------------------------------
85 /// @brief Returns the EGLDisplay.
86 ///
87 /// @return EGLDisplay.
88 ///
89 EGLDisplay GetEGLDisplay() const;
90
91 //----------------------------------------------------------------------------
92 /// @brief Create a new EGLContext using the same EGLConfig.
93 ///
94 /// @return The EGLContext.
95 ///
96 EGLContext CreateNewContext() const;
97
98 //----------------------------------------------------------------------------
99 /// @brief The EGLConfig for this context.
100 ///
101 EGLConfig Config() const { return config_; }
102
103 private:
105 EGLConfig config_;
106 EGLContext context_;
107 EGLContext resource_context_;
108 bool valid_ = false;
109 TaskRunners task_runners_;
110
112};
113
114} // namespace flutter
115
116#endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_CONTEXT_GL_SKIA_H_
std::unique_ptr< AndroidEGLSurface > CreateOffscreenSurface() const
Allocates an 1x1 pbuffer surface that is used for making the offscreen current for texture uploads.
EGLContext CreateNewContext() const
Create a new EGLContext using the same EGLConfig.
fml::RefPtr< AndroidEnvironmentGL > Environment() const
EGLConfig Config() const
The EGLConfig for this context.
std::unique_ptr< AndroidEGLSurface > CreateOnscreenSurface(const fml::RefPtr< AndroidNativeWindow > &window) const
Allocates an new EGL window surface that is used for on-screen pixels.
EGLContext GetEGLContext() const
Returns the EGLContext.
std::unique_ptr< AndroidEGLSurface > CreatePbufferSurface() const
Allocates an 1x1 pbuffer surface that is used for making the onscreen context current for snapshottin...
EGLDisplay GetEGLDisplay() const
Returns the EGLDisplay.
Holds state that is shared across Android surfaces.
GLFWwindow * window
Definition main.cc:60
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27