| Flutter Impeller |

Public Member Functions | Friends | List of all members
impeller::egl::Surface Class Reference

An instance of an EGL surface. There is no ability to create surfaces directly. Instead, one must be created using a Display connection. More...

`#include <surface.h>`

## Public Member Functions
| ~Surface ()
bool | IsValid () const
const EGLSurface & | GetHandle () const
bool | Present () const
| Present the surface. For an offscreen pixel buffer surface, this is a no-op. More...

## Friends
class | Display

## Detailed Description

An instance of an EGL surface. There is no ability to create surfaces directly. Instead, one must be created using a Display connection.

Definition at line 18 of file surface.h.

## Constructor & Destructor Documentation

## ◆ ~Surface()

impeller::egl::Surface::~Surface | ( |  | ) |

Definition at line 13 of file surface.cc.

13 {
14 if (surface_ != EGL_NO_SURFACE) {
15 if (::eglDestroySurface(display_, surface_) != EGL_TRUE) {
16 IMPELLER_LOG_EGL_ERROR;
17 }
18 }
19 }

References IMPELLER_LOG_EGL_ERROR.

## Member Function Documentation

## ◆ GetHandle()

const EGLSurface & impeller::egl::Surface::GetHandle | ( |  | ) | const

Returns
  Get the handle to the underlying surface.

Definition at line 21 of file surface.cc.

21 {
22 return surface_;
23 }

Referenced by impeller::egl::Context::MakeCurrent().

## ◆ IsValid()

bool impeller::egl::Surface::IsValid | ( |  | ) | const

Returns
  True if this is a valid surface.

Definition at line 25 of file surface.cc.

25 {
26 return surface_ != EGL_NO_SURFACE;
27 }

## ◆ Present()

bool impeller::egl::Surface::Present | ( |  | ) | const

Present the surface. For an offscreen pixel buffer surface, this is a no-op.

Returns
  True if the surface could be presented.

Definition at line 29 of file surface.cc.

29 {
30 const auto result = ::eglSwapBuffers(display_, surface_) == EGL_TRUE;
31 if (!result) {
32 IMPELLER_LOG_EGL_ERROR;
33 }
34 return result;
35 }

References IMPELLER_LOG_EGL_ERROR.

## Friends And Related Function Documentation

## ◆ Display

friend class Display
| friend

Definition at line 41 of file surface.h.

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

- impeller/toolkit/egl/surface.h
- impeller/toolkit/egl/surface.cc

IMPELLER_LOG_EGL_ERROR
#define IMPELLER_LOG_EGL_ERROR
Definition: egl.h:25