#include <context.h>
Definition at line 20 of file context.h.
◆ LifecycleListener
◆ LifecycleEvent
Enumerator |
---|
kDidMakeCurrent | |
kWillClearCurrent | |
Definition at line 34 of file context.h.
◆ Context()
Context::Context |
( |
EGLDisplay |
display, |
|
|
EGLContext |
context |
|
) |
| |
Definition at line 12 of file context.cc.
13 : display_(display), context_(context) {}
◆ ~Context()
Definition at line 15 of file context.cc.
15 {
16 if (context_ != EGL_NO_CONTEXT) {
17 if (::eglDestroyContext(display_, context_) != EGL_TRUE) {
19 }
20 }
21}
◆ AddLifecycleListener()
Definition at line 74 of file context.cc.
75 {
76 if (!listener) {
77 return std::nullopt;
78 }
79 WriterLock lock(listeners_mutex_);
81 listeners_[
id] = listener;
83}
◆ ClearCurrent()
bool Context::ClearCurrent |
( |
| ) |
const |
Definition at line 61 of file context.cc.
61 {
64 EGL_NO_SURFACE,
65 EGL_NO_SURFACE,
66 EGL_NO_CONTEXT
67 ) == EGL_TRUE;
70 }
72}
static EGLBoolean EGLMakeCurrentIfNecessary(EGLDisplay display, EGLSurface draw, EGLSurface read, EGLContext context)
◆ GetHandle()
const EGLContext & Context::GetHandle |
( |
| ) |
const |
Definition at line 27 of file context.cc.
27 {
28 return context_;
29}
◆ IsValid()
bool Context::IsValid |
( |
| ) |
const |
Definition at line 23 of file context.cc.
23 {
24 return context_ != EGL_NO_CONTEXT;
25}
◆ MakeCurrent()
bool Context::MakeCurrent |
( |
const Surface & |
surface | ) |
const |
Definition at line 45 of file context.cc.
45 {
46 if (context_ == EGL_NO_CONTEXT) {
47 return false;
48 }
52 context_
53 ) == EGL_TRUE;
56 }
59}
◆ RemoveLifecycleListener()
bool Context::RemoveLifecycleListener |
( |
UniqueID |
id | ) |
|
Definition at line 85 of file context.cc.
85 {
86 WriterLock lock(listeners_mutex_);
87 auto found = listeners_.find(id);
88 if (found == listeners_.end()) {
89 return false;
90 }
91 listeners_.erase(found);
92 return true;
93}
The documentation for this class was generated from the following files: