Flutter Engine
 
Loading...
Searching...
No Matches
context.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
8
9namespace flutter {
10namespace egl {
11
12Context::Context(EGLDisplay display, EGLContext context)
13 : display_(display), context_(context) {}
14
16 if (display_ == EGL_NO_DISPLAY && context_ == EGL_NO_CONTEXT) {
17 return;
18 }
19
20 if (::eglDestroyContext(display_, context_) != EGL_TRUE) {
22 }
23}
24
25bool Context::IsCurrent() const {
26 return ::eglGetCurrentContext() == context_;
27}
28
30 const auto result =
31 ::eglMakeCurrent(display_, EGL_NO_SURFACE, EGL_NO_SURFACE, context_);
32 if (result != EGL_TRUE) {
34 return false;
35 }
36
37 return true;
38}
39
41 const auto result = ::eglMakeCurrent(display_, EGL_NO_SURFACE, EGL_NO_SURFACE,
42 EGL_NO_CONTEXT);
43 if (result != EGL_TRUE) {
45 return false;
46 }
47
48 return true;
49}
50
51const EGLContext& Context::GetHandle() const {
52 return context_;
53}
54
55} // namespace egl
56} // namespace flutter
const EGLContext & GetHandle() const
Get the underlying handle to the EGL context.
Definition context.cc:27
bool IsCurrent() const
Definition context.cc:102
bool MakeCurrent(const Surface &surface) const
Make the context current on the calling thread. It is the caller responsibility to ensure that any co...
Definition context.cc:45
bool ClearCurrent() const
Clear the thread association of this context.
Definition context.cc:61
EGLDisplay display_
#define WINDOWS_LOG_EGL_ERROR
Definition egl.h:19