Flutter Engine
android_environment_gl.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 "flutter/shell/platform/android/android_environment_gl.h"
6 
7 namespace flutter {
8 
9 AndroidEnvironmentGL::AndroidEnvironmentGL()
10  : display_(EGL_NO_DISPLAY), valid_(false) {
11  // Get the display.
12  display_ = eglGetDisplay(EGL_DEFAULT_DISPLAY);
13 
14  if (display_ == EGL_NO_DISPLAY) {
15  return;
16  }
17 
18  // Initialize the display connection.
19  if (eglInitialize(display_, nullptr, nullptr) != EGL_TRUE) {
20  return;
21  }
22 
23  valid_ = true;
24 }
25 
26 AndroidEnvironmentGL::~AndroidEnvironmentGL() {
27  // Diconnect the display if valid.
28  if (display_ != EGL_NO_CONTEXT) {
29  eglTerminate(display_);
30  }
31 }
32 
34  return valid_;
35 }
36 
37 EGLDisplay AndroidEnvironmentGL::Display() const {
38  return display_;
39 }
40 
41 } // namespace flutter
EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
Definition: mock_egl.cc:263
EGLDisplay eglGetDisplay(EGLNativeDisplayType display_id)
Definition: mock_egl.cc:248