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_GLX_H_ | 5 #ifndef UI_GL_GL_SURFACE_GLX_H_ |
6 #define UI_GL_GL_SURFACE_GLX_H_ | 6 #define UI_GL_GL_SURFACE_GLX_H_ |
7 | 7 |
| 8 #include <string> |
| 9 |
8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
9 #include "ui/base/x/x11_util.h" | 11 #include "ui/base/x/x11_util.h" |
10 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
11 #include "ui/gfx/size.h" | 13 #include "ui/gfx/size.h" |
12 #include "ui/gl/gl_export.h" | 14 #include "ui/gl/gl_export.h" |
13 #include "ui/gl/gl_surface.h" | 15 #include "ui/gl/gl_surface.h" |
14 | 16 |
15 namespace gfx { | 17 namespace gfx { |
16 | 18 |
17 // Base class for GLX surfaces. | 19 // Base class for GLX surfaces. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 virtual bool Initialize() OVERRIDE; | 54 virtual bool Initialize() OVERRIDE; |
53 virtual void Destroy() OVERRIDE; | 55 virtual void Destroy() OVERRIDE; |
54 virtual bool Resize(const gfx::Size& size) OVERRIDE; | 56 virtual bool Resize(const gfx::Size& size) OVERRIDE; |
55 virtual bool IsOffscreen() OVERRIDE; | 57 virtual bool IsOffscreen() OVERRIDE; |
56 virtual bool SwapBuffers() OVERRIDE; | 58 virtual bool SwapBuffers() OVERRIDE; |
57 virtual gfx::Size GetSize() OVERRIDE; | 59 virtual gfx::Size GetSize() OVERRIDE; |
58 virtual void* GetHandle() OVERRIDE; | 60 virtual void* GetHandle() OVERRIDE; |
59 virtual std::string GetExtensions() OVERRIDE; | 61 virtual std::string GetExtensions() OVERRIDE; |
60 virtual void* GetConfig() OVERRIDE; | 62 virtual void* GetConfig() OVERRIDE; |
61 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 63 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
62 virtual bool GetVSyncParameters(base::TimeTicks* timebase, | 64 virtual void GetVSyncParameters(const UpdateVSyncCallback& callback) OVERRIDE; |
63 base::TimeDelta* interval) OVERRIDE; | 65 |
| 66 class VSyncProvider { |
| 67 public: |
| 68 virtual ~VSyncProvider() { } |
| 69 |
| 70 virtual void GetVSyncParameters( |
| 71 const GLSurface::UpdateVSyncCallback& callback) = 0; |
| 72 }; |
64 | 73 |
65 protected: | 74 protected: |
66 NativeViewGLSurfaceGLX(); | 75 NativeViewGLSurfaceGLX(); |
67 virtual ~NativeViewGLSurfaceGLX(); | 76 virtual ~NativeViewGLSurfaceGLX(); |
68 | 77 |
69 gfx::AcceleratedWidget window_; | 78 gfx::AcceleratedWidget window_; |
70 | 79 |
71 private: | 80 private: |
72 void* config_; | 81 void* config_; |
73 gfx::Size size_; | 82 gfx::Size size_; |
74 | 83 |
| 84 scoped_ptr<VSyncProvider> vsync_provider_; |
| 85 |
75 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceGLX); | 86 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceGLX); |
76 }; | 87 }; |
77 | 88 |
78 // A surface used to render to an offscreen pbuffer. | 89 // A surface used to render to an offscreen pbuffer. |
79 class GL_EXPORT PbufferGLSurfaceGLX : public GLSurfaceGLX { | 90 class GL_EXPORT PbufferGLSurfaceGLX : public GLSurfaceGLX { |
80 public: | 91 public: |
81 explicit PbufferGLSurfaceGLX(const gfx::Size& size); | 92 explicit PbufferGLSurfaceGLX(const gfx::Size& size); |
82 | 93 |
83 // Implement GLSurfaceGLX. | 94 // Implement GLSurfaceGLX. |
84 virtual bool Initialize() OVERRIDE; | 95 virtual bool Initialize() OVERRIDE; |
(...skipping 11 matching lines...) Expand all Loading... |
96 gfx::Size size_; | 107 gfx::Size size_; |
97 void* config_; | 108 void* config_; |
98 XID pbuffer_; | 109 XID pbuffer_; |
99 | 110 |
100 DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceGLX); | 111 DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceGLX); |
101 }; | 112 }; |
102 | 113 |
103 } // namespace gfx | 114 } // namespace gfx |
104 | 115 |
105 #endif // UI_GL_GL_SURFACE_GLX_H_ | 116 #endif // UI_GL_GL_SURFACE_GLX_H_ |
OLD | NEW |