Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
context.h
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#ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_EGL_CONTEXT_H_
6#define FLUTTER_SHELL_PLATFORM_WINDOWS_EGL_CONTEXT_H_
7
8#include <EGL/egl.h>
9
10#include "flutter/fml/macros.h"
11
12namespace flutter {
13namespace egl {
14
15// An EGL context to interact with OpenGL.
16//
17// This enables automatic error logging and mocking.
18//
19// Flutter Windows uses this to create render and resource contexts.
20class Context {
21 public:
22 Context(EGLDisplay display, EGLContext context);
23 ~Context();
24
25 // Check if this context is currently bound to the thread.
26 virtual bool IsCurrent() const;
27
28 // Bind the context to the thread without any read or draw surfaces.
29 //
30 // Returns true on success.
31 virtual bool MakeCurrent() const;
32
33 // Unbind any context and surfaces from the thread.
34 //
35 // Returns true on success.
36 virtual bool ClearCurrent() const;
37
38 // Get the raw EGL context.
39 virtual const EGLContext& GetHandle() const;
40
41 private:
42 EGLDisplay display_ = EGL_NO_DISPLAY;
43 EGLContext context_ = EGL_NO_CONTEXT;
44
46};
47
48} // namespace egl
49} // namespace flutter
50
51#endif // FLUTTER_SHELL_PLATFORM_WINDOWS_EGL_CONTEXT_H_
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
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27