Flutter Windows Embedder
window_surface.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_WINDOW_SURFACE_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_EGL_WINDOW_SURFACE_H_
7 
8 #include <EGL/egl.h>
9 
10 #include "flutter/fml/macros.h"
12 
13 namespace flutter {
14 namespace egl {
15 
16 // An EGL surface used to render a Flutter view to a win32 HWND.
17 //
18 // This enables automatic error logging and mocking.
19 class WindowSurface : public Surface {
20  public:
21  WindowSurface(EGLDisplay display,
22  EGLContext context,
23  EGLSurface surface,
24  size_t width,
25  size_t height);
26 
27  // If enabled, makes the surface's buffer swaps block until the v-blank.
28  //
29  // If disabled, allows one thread to swap multiple buffers per v-blank
30  // but can result in screen tearing if the system compositor is disabled.
31  //
32  // The surface must be current before calling this.
33  virtual bool SetVSyncEnabled(bool enabled);
34 
35  // Get the surface's width in physical pixels.
36  virtual size_t width() const;
37 
38  // Get the surface's height in physical pixels.
39  virtual size_t height() const;
40 
41  // Get whether the surface's buffer swap blocks until the v-blank.
42  virtual bool vsync_enabled() const;
43 
44  private:
45  size_t width_ = 0;
46  size_t height_ = 0;
47  bool vsync_enabled_ = true;
48 
49  FML_DISALLOW_COPY_AND_ASSIGN(WindowSurface);
50 };
51 
52 } // namespace egl
53 } // namespace flutter
54 
55 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_EGL_WINDOW_SURFACE_H_
flutter::egl::WindowSurface::SetVSyncEnabled
virtual bool SetVSyncEnabled(bool enabled)
Definition: window_surface.cc:20
flutter::egl::WindowSurface::vsync_enabled
virtual bool vsync_enabled() const
Definition: window_surface.cc:40
surface.h
flutter::egl::WindowSurface
Definition: window_surface.h:19
flutter::egl::WindowSurface::height
virtual size_t height() const
Definition: window_surface.cc:36
flutter
Definition: accessibility_bridge_windows.cc:11
flutter::egl::WindowSurface::width
virtual size_t width() const
Definition: window_surface.cc:32
flutter::egl::WindowSurface::WindowSurface
WindowSurface(EGLDisplay display, EGLContext context, EGLSurface surface, size_t width, size_t height)
Definition: window_surface.cc:13
flutter::egl::Surface
Definition: surface.h:18