| Flutter Windows Embedder |

window_surface.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/window_surface.h"
6
7 #include "flutter/fml/logging.h"
8 #include "flutter/shell/platform/windows/egl/egl.h"
9
10 namespace flutter {
11 namespace egl {
12
13 WindowSurface::WindowSurface(EGLDisplay display,
14 EGLContext context,
15 EGLSurface surface,
16 size_t width,
17 size_t height)
18 : Surface(display, context, surface), width_(width), height_(height) {}
19
20 bool WindowSurface::SetVSyncEnabled(bool enabled) {
21 FML_DCHECK(IsCurrent());
22
23 if (::eglSwapInterval(display_, enabled ? 1 : 0) != EGL_TRUE) {
24 WINDOWS_LOG_EGL_ERROR;
25 return false;
26 }
27
28 vsync_enabled_ = enabled;
29 return true;
30 }
31
32 size_t WindowSurface::width() const {
33 return width_;
34 }
35
36 size_t WindowSurface::height() const {
37 return height_;
38 }
39
40 bool WindowSurface::vsync_enabled() const {
41 return vsync_enabled_;
42 }
43
44 } // namespace egl
45 } // namespace flutter
flutter::egl::Surface
Definition: surface.h:18
flutter::egl::Surface::display_
EGLDisplay display_
Definition: surface.h:50
flutter::egl::Surface::IsCurrent
virtual bool IsCurrent() const
Definition: surface.cc:43
flutter::egl::WindowSurface::SetVSyncEnabled
virtual bool SetVSyncEnabled(bool enabled)
Definition: window_surface.cc:20
flutter::egl::WindowSurface::width
virtual size_t width() const
Definition: window_surface.cc:32
flutter::egl::WindowSurface::vsync_enabled
virtual bool vsync_enabled() const
Definition: window_surface.cc:40
flutter::egl::WindowSurface::height
virtual size_t height() const
Definition: window_surface.cc:36
flutter::egl::WindowSurface::WindowSurface
WindowSurface(EGLDisplay display, EGLContext context, EGLSurface surface, size_t width, size_t height)
Definition: window_surface.cc:13
egl.h
WINDOWS_LOG_EGL_ERROR
#define WINDOWS_LOG_EGL_ERROR
Definition: egl.h:19
flutter
Definition: accessibility_bridge_windows.cc:11
window_surface.h