| Flutter Windows Embedder |

Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
flutter::egl::Manager Class Reference

`#include <manager.h>`

## Public Member Functions
virtual | ~Manager ()
bool | IsValid () const
virtual std::unique_ptr< WindowSurface > | CreateWindowSurface (HWND hwnd, size_t width, size_t height)
bool | HasContextCurrent ()
EGLSurface | CreateSurfaceFromHandle (EGLenum handle_type, EGLClientBuffer handle, const EGLint *attributes) const
EGLDisplay | egl_display () const
bool | GetDevice (ID3D11Device **device)
virtual Context * | render_context () const
virtual Context * | resource_context () const

## Static Public Member Functions
static std::unique_ptr< Manager > | Create ()

## Protected Member Functions
| Manager ()

## Detailed Description

Definition at line 31 of file manager.h.

## Constructor & Destructor Documentation

## ◆ ~Manager()

flutter::egl::Manager::~Manager | ( |  | ) |
| virtual

Definition at line 44 of file manager.cc.

44 {
45 CleanUp();
46 --instance_count_;
47 }

## ◆ Manager()

flutter::egl::Manager::Manager | ( |  | ) |
| explicit protected

Definition at line 26 of file manager.cc.

26 {
27 ++instance_count_;
28
29 if (!InitializeDisplay()) {
30 return;
31 }
32
33 if (!InitializeConfig()) {
34 return;
35 }
36
37 if (!InitializeContexts()) {
38 return;
39 }
40
41 is_valid_ = true;
42 }

Referenced by Create().

## Member Function Documentation

## ◆ Create()

std::unique_ptr< Manager > flutter::egl::Manager::Create | ( |  | ) |
| static

Definition at line 17 of file manager.cc.

17 {
18 std::unique_ptr<Manager> manager;
19 manager.reset(new Manager());
20 if (!manager->IsValid()) {
21 return nullptr;
22 }
23 return std::move(manager);
24 }

References Manager().

## ◆ CreateSurfaceFromHandle()

EGLSurface flutter::egl::Manager::CreateSurfaceFromHandle | ( | EGLenum | handle_type,
|  | EGLClientBuffer | handle,
|  | const EGLint * | attributes
| ) |  | const

Definition at line 273 of file manager.cc.

275 {
276 return ::eglCreatePbufferFromClientBuffer(display_, handle_type, handle,
277 config_, attributes);
278 }

## ◆ CreateWindowSurface()

std::unique_ptr< WindowSurface > flutter::egl::Manager::CreateWindowSurface | ( | HWND | hwnd,
|  | size_t | width,
|  | size_t | height
| ) |  |
| virtual

Definition at line 239 of file manager.cc.

241 {
242 if (!hwnd || !is_valid_) {
243 return nullptr;
244 }
245
246 // Disable ANGLE's automatic surface resizing and provide an explicit size.
247 // The surface will need to be destroyed and re-created if the HWND is
248 // resized.
249 const EGLint surface_attributes[] = {EGL_FIXED_SIZE_ANGLE,
250 EGL_TRUE,
251 EGL_WIDTH,
252 static_cast<EGLint>(width),
253 EGL_HEIGHT,
254 static_cast<EGLint>(height),
255 EGL_NONE};
256
257 auto const surface = ::eglCreateWindowSurface(
258 display_, config_, static_cast<EGLNativeWindowType>(hwnd),
259 surface_attributes);
260 if (surface == EGL_NO_SURFACE) {
261 LogEGLError("Surface creation failed.");
262 return nullptr;
263 }
264
265 return std::make_unique<WindowSurface>(display_, render_context_->GetHandle(),
266 surface, width, height);
267 }

References flutter::egl::LogEGLError().

Referenced by flutter::FlutterWindowsView::CreateRenderSurface().

## ◆ egl_display()

EGLDisplay flutter::egl::Manager::egl_display | ( |  | ) | const
| inline

Definition at line 63 of file manager.h.

63 { return display_; };

## ◆ GetDevice()

bool flutter::egl::Manager::GetDevice | ( | ID3D11Device ** | device | ) |

Definition at line 280 of file manager.cc.

280 {
281 if (!resolved_device_) {
282 if (!InitializeDevice()) {
283 return false;
284 }
285 }
286
287 resolved_device_.CopyTo(device);
288 return (resolved_device_ != nullptr);
289 }

## ◆ HasContextCurrent()

bool flutter::egl::Manager::HasContextCurrent | ( |  | ) |

Definition at line 269 of file manager.cc.

269 {
270 return ::eglGetCurrentContext() != EGL_NO_CONTEXT;
271 }

## ◆ IsValid()

bool flutter::egl::Manager::IsValid | ( |  | ) | const

Definition at line 235 of file manager.cc.

235 {
236 return is_valid_;
237 }

## ◆ render_context()

Context * flutter::egl::Manager::render_context | ( |  | ) | const
| virtual

Definition at line 291 of file manager.cc.

291 {
292 return render_context_.get();
293 }

## ◆ resource_context()

Context * flutter::egl::Manager::resource_context | ( |  | ) | const
| virtual

Definition at line 295 of file manager.cc.

295 {
296 return resource_context_.get();
297 }

The documentation for this class was generated from the following files:

- shell/platform/windows/egl/manager.h
- shell/platform/windows/egl/manager.cc

flutter::egl::Manager::Manager
Manager()
Definition: manager.cc:26
flutter::egl::LogEGLError
void LogEGLError(std::string_view message)
Log the last EGL error with an error message.
Definition: egl.cc:55