Flutter Engine
The 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
5#include "flutter/shell/platform/windows/egl/context.h"
6
7#include "flutter/shell/platform/windows/egl/egl.h"
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
Context(EGLDisplay display, EGLContext context)
Definition context.cc:12
virtual bool ClearCurrent() const
Definition context.cc:40
virtual bool IsCurrent() const
Definition context.cc:25
virtual const EGLContext & GetHandle() const
Definition context.cc:51
virtual bool MakeCurrent() const
Definition context.cc:29
GAsyncResult * result
EGLDisplay display_
#define WINDOWS_LOG_EGL_ERROR
Definition egl.h:19