Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
7namespace flutter {
8
9AndroidEnvironmentGL::AndroidEnvironmentGL() : display_(EGL_NO_DISPLAY) {
10 // Get the display.
11 display_ = eglGetDisplay(EGL_DEFAULT_DISPLAY);
12
13 if (display_ == EGL_NO_DISPLAY) {
14 return;
15 }
16
17 // Initialize the display connection.
18 if (eglInitialize(display_, nullptr, nullptr) != EGL_TRUE) {
19 return;
20 }
21
22 valid_ = true;
23}
24
25AndroidEnvironmentGL::~AndroidEnvironmentGL() {
26 // Disconnect the display if valid.
27 if (display_ != EGL_NO_DISPLAY) {
28 eglTerminate(display_);
29 }
30}
31
32bool AndroidEnvironmentGL::IsValid() const {
33 return valid_;
34}
35
36EGLDisplay AndroidEnvironmentGL::Display() const {
37 return display_;
38}
39
40} // namespace flutter
EGLDisplay display_