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_H_ | 5 #ifndef UI_GL_GL_SURFACE_H_ |
6 #define UI_GL_GL_SURFACE_H_ | 6 #define UI_GL_GL_SURFACE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
13 #include "ui/gfx/size.h" | 13 #include "ui/gfx/size.h" |
14 #include "ui/gl/gl_export.h" | 14 #include "ui/gl/gl_export.h" |
15 | 15 |
| 16 namespace base { |
| 17 class TimeDelta; |
| 18 class TimeTicks; |
| 19 } |
| 20 |
16 namespace gfx { | 21 namespace gfx { |
17 | 22 |
18 class GLContext; | 23 class GLContext; |
19 | 24 |
20 #if defined(OS_ANDROID) | 25 #if defined(OS_ANDROID) |
21 class AndroidNativeWindow; | 26 class AndroidNativeWindow; |
22 #endif | 27 #endif |
23 | 28 |
24 // Encapsulates a surface that can be rendered to with GL, hiding platform | 29 // Encapsulates a surface that can be rendered to with GL, hiding platform |
25 // specific management. | 30 // specific management. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // Get the platform specific display on which this surface resides, if | 100 // Get the platform specific display on which this surface resides, if |
96 // available. | 101 // available. |
97 virtual void* GetDisplay(); | 102 virtual void* GetDisplay(); |
98 | 103 |
99 // Get the platfrom specific configuration for this surface, if available. | 104 // Get the platfrom specific configuration for this surface, if available. |
100 virtual void* GetConfig(); | 105 virtual void* GetConfig(); |
101 | 106 |
102 // Get the GL pixel format of the surface, if available. | 107 // Get the GL pixel format of the surface, if available. |
103 virtual unsigned GetFormat(); | 108 virtual unsigned GetFormat(); |
104 | 109 |
| 110 // Get the time of the most recent screen refresh, along with the time |
| 111 // between consecutive refreshes. Returns false when these values are |
| 112 // unavailable. |
| 113 virtual bool GetVSyncParameters(base::TimeTicks* timebase, |
| 114 base::TimeDelta* interval); |
| 115 |
105 // Create a GL surface that renders directly to a view. | 116 // Create a GL surface that renders directly to a view. |
106 static scoped_refptr<GLSurface> CreateViewGLSurface( | 117 static scoped_refptr<GLSurface> CreateViewGLSurface( |
107 bool software, | 118 bool software, |
108 gfx::AcceleratedWidget window); | 119 gfx::AcceleratedWidget window); |
109 | 120 |
110 // Create a GL surface used for offscreen rendering. | 121 // Create a GL surface used for offscreen rendering. |
111 static scoped_refptr<GLSurface> CreateOffscreenGLSurface( | 122 static scoped_refptr<GLSurface> CreateOffscreenGLSurface( |
112 bool software, | 123 bool software, |
113 const gfx::Size& size); | 124 const gfx::Size& size); |
114 | 125 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 virtual gfx::Size GetSize() OVERRIDE; | 157 virtual gfx::Size GetSize() OVERRIDE; |
147 virtual void* GetHandle() OVERRIDE; | 158 virtual void* GetHandle() OVERRIDE; |
148 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; | 159 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; |
149 virtual bool OnMakeCurrent(GLContext* context) OVERRIDE; | 160 virtual bool OnMakeCurrent(GLContext* context) OVERRIDE; |
150 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; | 161 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; |
151 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; | 162 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; |
152 virtual void* GetShareHandle() OVERRIDE; | 163 virtual void* GetShareHandle() OVERRIDE; |
153 virtual void* GetDisplay() OVERRIDE; | 164 virtual void* GetDisplay() OVERRIDE; |
154 virtual void* GetConfig() OVERRIDE; | 165 virtual void* GetConfig() OVERRIDE; |
155 virtual unsigned GetFormat() OVERRIDE; | 166 virtual unsigned GetFormat() OVERRIDE; |
| 167 virtual bool GetVSyncParameters(base::TimeTicks* timebase, |
| 168 base::TimeDelta* interval) OVERRIDE; |
156 | 169 |
157 GLSurface* surface() const { return surface_.get(); } | 170 GLSurface* surface() const { return surface_.get(); } |
158 | 171 |
159 protected: | 172 protected: |
160 virtual ~GLSurfaceAdapter(); | 173 virtual ~GLSurfaceAdapter(); |
161 | 174 |
162 private: | 175 private: |
163 scoped_refptr<GLSurface> surface_; | 176 scoped_refptr<GLSurface> surface_; |
164 | 177 |
165 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); | 178 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); |
166 }; | 179 }; |
167 | 180 |
168 } // namespace gfx | 181 } // namespace gfx |
169 | 182 |
170 #endif // UI_GL_GL_SURFACE_H_ | 183 #endif // UI_GL_GL_SURFACE_H_ |
OLD | NEW |