Flutter Windows Embedder
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 
9 namespace flutter {
10 namespace egl {
11 
12 Context::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 
25 bool Context::IsCurrent() const {
26  return ::eglGetCurrentContext() == context_;
27 }
28 
29 bool Context::MakeCurrent() const {
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 
40 bool Context::ClearCurrent() const {
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 
51 const EGLContext& Context::GetHandle() const {
52  return context_;
53 }
54 
55 } // namespace egl
56 } // namespace flutter
WINDOWS_LOG_EGL_ERROR
#define WINDOWS_LOG_EGL_ERROR
Definition: egl.h:19
egl.h
flutter::egl::Context::MakeCurrent
virtual bool MakeCurrent() const
Definition: context.cc:29
flutter::egl::Context::GetHandle
virtual const EGLContext & GetHandle() const
Definition: context.cc:51
flutter
Definition: accessibility_bridge_windows.cc:11
flutter::egl::Context::Context
Context(EGLDisplay display, EGLContext context)
Definition: context.cc:12
flutter::egl::Context::IsCurrent
virtual bool IsCurrent() const
Definition: context.cc:25
flutter::egl::Context::~Context
~Context()
Definition: context.cc:15
context.h
flutter::egl::Context::ClearCurrent
virtual bool ClearCurrent() const
Definition: context.cc:40