Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
flutter::egl::Surface Class Reference

#include <surface.h>

Inheritance diagram for flutter::egl::Surface:
flutter::egl::WindowSurface flutter::testing::egl::MockWindowSurface

Public Member Functions

 Surface (EGLDisplay display, EGLContext context, EGLSurface surface)
 
virtual ~Surface ()
 
virtual bool Destroy ()
 
virtual bool IsValid () const
 
virtual bool IsCurrent () const
 
virtual bool MakeCurrent () const
 
virtual bool SwapBuffers () const
 
virtual const EGLSurface & GetHandle () const
 

Protected Member Functions

 FML_DISALLOW_COPY_AND_ASSIGN (Surface)
 

Protected Attributes

bool is_valid_ = true
 
EGLDisplay display_ = EGL_NO_DISPLAY
 
EGLContext context_ = EGL_NO_CONTEXT
 
EGLSurface surface_ = EGL_NO_SURFACE
 

Detailed Description

Definition at line 18 of file surface.h.

Constructor & Destructor Documentation

◆ Surface()

Surface::Surface ( EGLDisplay  display,
EGLContext  context,
EGLSurface  surface 
)

Definition at line 12 of file surface.cc.

13 : display_(display), context_(context), surface_(surface) {}
EGLDisplay display_
Definition: surface.h:50
EGLContext context_
Definition: surface.h:51
EGLSurface surface_
Definition: surface.h:52
VkSurfaceKHR surface
Definition: main.cc:49

◆ ~Surface()

Surface::~Surface ( )
virtual

Definition at line 15 of file surface.cc.

15 {
16 Destroy();
17}
virtual bool Destroy()
Definition: surface.cc:23

Member Function Documentation

◆ Destroy()

bool Surface::Destroy ( )
virtual

Definition at line 23 of file surface.cc.

23 {
24 if (surface_ != EGL_NO_SURFACE) {
25 // Ensure the surface is not current before destroying it.
26 if (::eglMakeCurrent(display_, EGL_NO_SURFACE, EGL_NO_SURFACE,
27 EGL_NO_CONTEXT) != EGL_TRUE) {
29 return false;
30 }
31
32 if (::eglDestroySurface(display_, surface_) != EGL_TRUE) {
34 return false;
35 }
36 }
37
38 is_valid_ = false;
39 surface_ = EGL_NO_SURFACE;
40 return true;
41}
#define WINDOWS_LOG_EGL_ERROR
Definition: egl.h:19

◆ FML_DISALLOW_COPY_AND_ASSIGN()

flutter::egl::Surface::FML_DISALLOW_COPY_AND_ASSIGN ( Surface  )
protected

◆ GetHandle()

const EGLSurface & Surface::GetHandle ( ) const
virtual

Definition at line 68 of file surface.cc.

68 {
69 return surface_;
70}

◆ IsCurrent()

bool Surface::IsCurrent ( ) const
virtual

Definition at line 43 of file surface.cc.

43 {
44 return display_ == ::eglGetCurrentDisplay() &&
45 surface_ == ::eglGetCurrentSurface(EGL_DRAW) &&
46 surface_ == ::eglGetCurrentSurface(EGL_READ) &&
47 context_ == ::eglGetCurrentContext();
48}

◆ IsValid()

bool Surface::IsValid ( ) const
virtual

Definition at line 19 of file surface.cc.

19 {
20 return is_valid_;
21}

◆ MakeCurrent()

bool Surface::MakeCurrent ( ) const
virtual

Definition at line 50 of file surface.cc.

50 {
51 if (::eglMakeCurrent(display_, surface_, surface_, context_) != EGL_TRUE) {
53 return false;
54 }
55
56 return true;
57}

◆ SwapBuffers()

bool Surface::SwapBuffers ( ) const
virtual

Definition at line 59 of file surface.cc.

59 {
60 if (::eglSwapBuffers(display_, surface_) != EGL_TRUE) {
62 return false;
63 }
64
65 return true;
66}

Member Data Documentation

◆ context_

EGLContext flutter::egl::Surface::context_ = EGL_NO_CONTEXT
protected

Definition at line 51 of file surface.h.

◆ display_

EGLDisplay flutter::egl::Surface::display_ = EGL_NO_DISPLAY
protected

Definition at line 50 of file surface.h.

◆ is_valid_

bool flutter::egl::Surface::is_valid_ = true
protected

Definition at line 48 of file surface.h.

◆ surface_

EGLSurface flutter::egl::Surface::surface_ = EGL_NO_SURFACE
protected

Definition at line 52 of file surface.h.


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