| 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
5 #include "impeller/toolkit/egl/surface.h"
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) {
16 IMPELLER_LOG_EGL_ERROR;
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) {
32 IMPELLER_LOG_EGL_ERROR;
33 }
34 return result;
35 }
36
37 } // namespace egl
38 } // namespace impeller
impeller::egl::Surface::Surface
Surface(EGLDisplay display, EGLSurface surface)
Definition: surface.cc:10
impeller::egl::Surface::IsValid
bool IsValid() const
Definition: surface.cc:25
impeller::egl::Surface::Present
bool Present() const
Definition: surface.cc:29
impeller::egl::Surface::GetHandle
const EGLSurface & GetHandle() const
Definition: surface.cc:21
surface.h
IMPELLER_LOG_EGL_ERROR
#define IMPELLER_LOG_EGL_ERROR
Definition: egl.h:19
impeller::egl::Surface::~Surface
~Surface()
Definition: surface.cc:13
impeller
Definition: aiks_blur_unittests.cc:20