Flutter Impeller
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 
7 namespace impeller {
8 namespace egl {
9 
10 Surface::Surface(EGLDisplay display, EGLSurface surface)
11  : display_(display), surface_(surface) {}
12 
13 Surface::~Surface() {
14  if (surface_ != EGL_NO_SURFACE) {
15  if (::eglDestroySurface(display_, surface_) != EGL_TRUE) {
17  }
18  }
19 }
20 
21 const EGLSurface& Surface::GetHandle() const {
22  return surface_;
23 }
24 
25 bool Surface::IsValid() const {
26  return surface_ != EGL_NO_SURFACE;
27 }
28 
29 bool 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
#define IMPELLER_LOG_EGL_ERROR
Definition: egl.h:25