Flutter Windows Embedder
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 
6 
7 #include "flutter/fml/logging.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) {
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 
41  return vsync_enabled_;
42 }
43 
44 } // namespace egl
45 } // namespace flutter
EGLDisplay display_
Definition: surface.h:50
virtual bool IsCurrent() const
Definition: surface.cc:43
virtual bool SetVSyncEnabled(bool enabled)
virtual size_t width() const
virtual bool vsync_enabled() const
virtual size_t height() const
WindowSurface(EGLDisplay display, EGLContext context, EGLSurface surface, size_t width, size_t height)
#define WINDOWS_LOG_EGL_ERROR
Definition: egl.h:19