OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_GL_GL_SURFACE_EGL_H_ | 5 #ifndef UI_GL_GL_SURFACE_EGL_H_ |
6 #define UI_GL_GL_SURFACE_EGL_H_ | 6 #define UI_GL_GL_SURFACE_EGL_H_ |
7 | 7 |
8 #if defined(OS_WIN) | 8 #if defined(OS_WIN) |
9 #include <windows.h> | 9 #include <windows.h> |
10 #endif | 10 #endif |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "ui/gfx/size.h" | 16 #include "ui/gfx/geometry/size.h" |
17 #include "ui/gfx/vsync_provider.h" | 17 #include "ui/gfx/vsync_provider.h" |
18 #include "ui/gl/gl_bindings.h" | 18 #include "ui/gl/gl_bindings.h" |
19 #include "ui/gl/gl_surface.h" | 19 #include "ui/gl/gl_surface.h" |
20 | 20 |
21 namespace gfx { | 21 namespace gfx { |
22 | 22 |
23 // Get default EGL display for GLSurfaceEGL (differs by platform). | 23 // Get default EGL display for GLSurfaceEGL (differs by platform). |
24 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay(); | 24 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay(); |
25 | 25 |
26 // Interface for EGL surface. | 26 // Interface for EGL surface. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 // Create a NativeViewGLSurfaceEGL with an externally provided VSyncProvider. | 77 // Create a NativeViewGLSurfaceEGL with an externally provided VSyncProvider. |
78 // Takes ownership of the VSyncProvider. | 78 // Takes ownership of the VSyncProvider. |
79 virtual bool Initialize(scoped_ptr<VSyncProvider> sync_provider); | 79 virtual bool Initialize(scoped_ptr<VSyncProvider> sync_provider); |
80 | 80 |
81 protected: | 81 protected: |
82 ~NativeViewGLSurfaceEGL() override; | 82 ~NativeViewGLSurfaceEGL() override; |
83 | 83 |
84 EGLNativeWindowType window_; | 84 EGLNativeWindowType window_; |
85 | 85 |
| 86 void OnSetSwapInterval(int interval) override; |
| 87 |
86 private: | 88 private: |
87 EGLSurface surface_; | 89 EGLSurface surface_; |
88 bool supports_post_sub_buffer_; | 90 bool supports_post_sub_buffer_; |
89 EGLConfig config_; | 91 EGLConfig config_; |
90 gfx::Size size_; | 92 gfx::Size size_; |
91 | 93 |
92 scoped_ptr<VSyncProvider> vsync_provider_; | 94 scoped_ptr<VSyncProvider> vsync_provider_; |
93 | 95 |
| 96 int swap_interval_; |
| 97 |
| 98 #if defined(OS_WIN) |
| 99 bool vsync_override_; |
| 100 |
| 101 unsigned int swap_generation_; |
| 102 static unsigned int current_swap_generation_; |
| 103 static unsigned int swaps_this_generation_; |
| 104 static unsigned int last_multiswap_generation_; |
| 105 #endif |
| 106 |
94 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceEGL); | 107 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceEGL); |
95 }; | 108 }; |
96 | 109 |
97 // Encapsulates a pbuffer EGL surface. | 110 // Encapsulates a pbuffer EGL surface. |
98 class GL_EXPORT PbufferGLSurfaceEGL : public GLSurfaceEGL { | 111 class GL_EXPORT PbufferGLSurfaceEGL : public GLSurfaceEGL { |
99 public: | 112 public: |
100 explicit PbufferGLSurfaceEGL(const gfx::Size& size); | 113 explicit PbufferGLSurfaceEGL(const gfx::Size& size); |
101 | 114 |
102 // Implement GLSurface. | 115 // Implement GLSurface. |
103 EGLConfig GetConfig() override; | 116 EGLConfig GetConfig() override; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 ~SurfacelessEGL() override; | 156 ~SurfacelessEGL() override; |
144 | 157 |
145 private: | 158 private: |
146 gfx::Size size_; | 159 gfx::Size size_; |
147 DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL); | 160 DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL); |
148 }; | 161 }; |
149 | 162 |
150 } // namespace gfx | 163 } // namespace gfx |
151 | 164 |
152 #endif // UI_GL_GL_SURFACE_EGL_H_ | 165 #endif // UI_GL_GL_SURFACE_EGL_H_ |
OLD | NEW |