Flutter Windows Embedder
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 
12 namespace flutter {
13 namespace 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.
20 class 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 
45  FML_DISALLOW_COPY_AND_ASSIGN(Context);
46 };
47 
48 } // namespace egl
49 } // namespace flutter
50 
51 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_EGL_CONTEXT_H_
flutter::egl::Context::MakeCurrent
virtual bool MakeCurrent() const
Definition: context.cc:29
flutter::egl::Context
Definition: context.h:20
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
flutter::egl::Context::ClearCurrent
virtual bool ClearCurrent() const
Definition: context.cc:40