| 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/callback.h" |
| 10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
| 13 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
| 14 #include "ui/gl/gl_export.h" | 15 #include "ui/gl/gl_export.h" |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 class TimeDelta; | 18 class TimeDelta; |
| 18 class TimeTicks; | 19 class TimeTicks; |
| 19 } | 20 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // Get the platform specific display on which this surface resides, if | 101 // Get the platform specific display on which this surface resides, if |
| 101 // available. | 102 // available. |
| 102 virtual void* GetDisplay(); | 103 virtual void* GetDisplay(); |
| 103 | 104 |
| 104 // Get the platfrom specific configuration for this surface, if available. | 105 // Get the platfrom specific configuration for this surface, if available. |
| 105 virtual void* GetConfig(); | 106 virtual void* GetConfig(); |
| 106 | 107 |
| 107 // Get the GL pixel format of the surface, if available. | 108 // Get the GL pixel format of the surface, if available. |
| 108 virtual unsigned GetFormat(); | 109 virtual unsigned GetFormat(); |
| 109 | 110 |
| 111 typedef base::Callback<void(const base::TimeTicks timebase, |
| 112 const base::TimeDelta interval)> |
| 113 UpdateVSyncCallback; |
| 114 |
| 110 // Get the time of the most recent screen refresh, along with the time | 115 // Get the time of the most recent screen refresh, along with the time |
| 111 // between consecutive refreshes. Returns false when these values are | 116 // between consecutive refreshes. The callback is called as soon as |
| 112 // unavailable. | 117 // the data is available: it could be immediately from this method, |
| 113 virtual bool GetVSyncParameters(base::TimeTicks* timebase, | 118 // later via a PostTask to the current MessageLoop, or never (if we have |
| 114 base::TimeDelta* interval); | 119 // no data source). We provide the strong guarantee that the callback will |
| 120 // not be called once the instance of this class is destroyed. |
| 121 virtual void GetVSyncParameters(const UpdateVSyncCallback& callback); |
| 115 | 122 |
| 116 // Create a GL surface that renders directly to a view. | 123 // Create a GL surface that renders directly to a view. |
| 117 static scoped_refptr<GLSurface> CreateViewGLSurface( | 124 static scoped_refptr<GLSurface> CreateViewGLSurface( |
| 118 bool software, | 125 bool software, |
| 119 gfx::AcceleratedWidget window); | 126 gfx::AcceleratedWidget window); |
| 120 | 127 |
| 121 // Create a GL surface used for offscreen rendering. | 128 // Create a GL surface used for offscreen rendering. |
| 122 static scoped_refptr<GLSurface> CreateOffscreenGLSurface( | 129 static scoped_refptr<GLSurface> CreateOffscreenGLSurface( |
| 123 bool software, | 130 bool software, |
| 124 const gfx::Size& size); | 131 const gfx::Size& size); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 virtual gfx::Size GetSize() OVERRIDE; | 164 virtual gfx::Size GetSize() OVERRIDE; |
| 158 virtual void* GetHandle() OVERRIDE; | 165 virtual void* GetHandle() OVERRIDE; |
| 159 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; | 166 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; |
| 160 virtual bool OnMakeCurrent(GLContext* context) OVERRIDE; | 167 virtual bool OnMakeCurrent(GLContext* context) OVERRIDE; |
| 161 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; | 168 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; |
| 162 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; | 169 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; |
| 163 virtual void* GetShareHandle() OVERRIDE; | 170 virtual void* GetShareHandle() OVERRIDE; |
| 164 virtual void* GetDisplay() OVERRIDE; | 171 virtual void* GetDisplay() OVERRIDE; |
| 165 virtual void* GetConfig() OVERRIDE; | 172 virtual void* GetConfig() OVERRIDE; |
| 166 virtual unsigned GetFormat() OVERRIDE; | 173 virtual unsigned GetFormat() OVERRIDE; |
| 167 virtual bool GetVSyncParameters(base::TimeTicks* timebase, | 174 virtual void GetVSyncParameters(const UpdateVSyncCallback& callback) OVERRIDE; |
| 168 base::TimeDelta* interval) OVERRIDE; | |
| 169 | 175 |
| 170 GLSurface* surface() const { return surface_.get(); } | 176 GLSurface* surface() const { return surface_.get(); } |
| 171 | 177 |
| 172 protected: | 178 protected: |
| 173 virtual ~GLSurfaceAdapter(); | 179 virtual ~GLSurfaceAdapter(); |
| 174 | 180 |
| 175 private: | 181 private: |
| 176 scoped_refptr<GLSurface> surface_; | 182 scoped_refptr<GLSurface> surface_; |
| 177 | 183 |
| 178 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); | 184 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); |
| 179 }; | 185 }; |
| 180 | 186 |
| 181 } // namespace gfx | 187 } // namespace gfx |
| 182 | 188 |
| 183 #endif // UI_GL_GL_SURFACE_H_ | 189 #endif // UI_GL_GL_SURFACE_H_ |
| OLD | NEW |