Flutter Engine
The Flutter Engine
surface.cc
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
6
7namespace impeller {
8namespace egl {
9
10Surface::Surface(EGLDisplay display, EGLSurface surface)
11 : display_(display), surface_(surface) {}
12
13Surface::~Surface() {
14 if (surface_ != EGL_NO_SURFACE) {
15 if (::eglDestroySurface(display_, surface_) != EGL_TRUE) {
17 }
18 }
19}
20
21const EGLSurface& Surface::GetHandle() const {
22 return surface_;
23}
24
25bool Surface::IsValid() const {
26 return surface_ != EGL_NO_SURFACE;
27}
28
29bool Surface::Present() const {
30 const auto result = ::eglSwapBuffers(display_, surface_) == EGL_TRUE;
31 if (!result) {
33 }
34 return result;
35}
36
37} // namespace egl
38} // namespace impeller
VkSurfaceKHR surface
Definition: main.cc:49
GAsyncResult * result
EGLDisplay display_
EGLSurface surface_
#define IMPELLER_LOG_EGL_ERROR
Definition: egl.h:25