Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
shell
platform
windows
egl
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
9
namespace
flutter
{
10
namespace
egl {
11
12
Context::Context
(EGLDisplay display, EGLContext context)
13
:
display_
(display), context_(context) {}
14
15
Context::~Context
() {
16
if
(display_ == EGL_NO_DISPLAY && context_ == EGL_NO_CONTEXT) {
17
return
;
18
}
19
20
if
(::eglDestroyContext(display_, context_) != EGL_TRUE) {
21
WINDOWS_LOG_EGL_ERROR
;
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) {
33
WINDOWS_LOG_EGL_ERROR
;
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) {
44
WINDOWS_LOG_EGL_ERROR
;
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
flutter::egl::Context::~Context
~Context()
Definition
context.cc:15
flutter::egl::Context::Context
Context(EGLDisplay display, EGLContext context)
Definition
context.cc:12
flutter::egl::Context::ClearCurrent
virtual bool ClearCurrent() const
Definition
context.cc:40
flutter::egl::Context::IsCurrent
virtual bool IsCurrent() const
Definition
context.cc:25
flutter::egl::Context::GetHandle
virtual const EGLContext & GetHandle() const
Definition
context.cc:51
flutter::egl::Context::MakeCurrent
virtual bool MakeCurrent() const
Definition
context.cc:29
result
GAsyncResult * result
Definition
fl_text_input_plugin.cc:106
display_
EGLDisplay display_
Definition
FlutterEmbedderGLFW.cc:38
flutter
Definition
asset_manager.cc:10
WINDOWS_LOG_EGL_ERROR
#define WINDOWS_LOG_EGL_ERROR
Definition
egl.h:19
Generated on Fri Apr 26 2024 06:14:15 for Flutter Engine by
1.9.8