Flutter Engine
The Flutter Engine
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"
11#include "flutter/shell/platform/windows/egl/surface.h"
12
13namespace flutter {
14namespace 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.
19class 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_
virtual bool vsync_enabled() const
virtual size_t height() const
virtual size_t width() const
virtual bool SetVSyncEnabled(bool enabled)
WindowSurface(EGLDisplay display, EGLContext context, EGLSurface surface, size_t width, size_t height)
VkSurfaceKHR surface
Definition: main.cc:49