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/callback.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 unsigned filter); | 186 unsigned filter); |
187 | 187 |
188 virtual bool IsSurfaceless() const; | 188 virtual bool IsSurfaceless() const; |
189 | 189 |
190 virtual bool FlipsVertically() const; | 190 virtual bool FlipsVertically() const; |
191 | 191 |
192 // Returns true if SwapBuffers or PostSubBuffers causes a flip, such that | 192 // Returns true if SwapBuffers or PostSubBuffers causes a flip, such that |
193 // the next buffer may be 2 frames old. | 193 // the next buffer may be 2 frames old. |
194 virtual bool BuffersFlipped() const; | 194 virtual bool BuffersFlipped() const; |
195 | 195 |
196 // Create a GL surface that renders directly to a view. | |
197 // DEPRECATED(kylechar): Use gl::init::CreateViewGLSurface from gl_factory.h. | |
198 static scoped_refptr<GLSurface> CreateViewGLSurface( | |
199 gfx::AcceleratedWidget window); | |
200 | |
201 #if defined(USE_OZONE) | |
202 // Create a GL surface that renders directly into a window with surfaceless | |
203 // semantics - there is no default framebuffer and the primary surface must | |
204 // be presented as an overlay. If surfaceless mode is not supported or | |
205 // enabled it will return a null pointer. | |
206 // DEPRECATED(kylechar): Use gl::init::CreateSurfacelessViewGLSurface from | |
207 // gl_factory.h. | |
208 static scoped_refptr<GLSurface> CreateSurfacelessViewGLSurface( | |
209 gfx::AcceleratedWidget window); | |
210 #endif // defined(USE_OZONE) | |
211 | |
212 // Create a GL surface used for offscreen rendering. | |
213 // DEPRECATED(kylechar): Use gl::init::CreateOffscreenGLSurface from | |
214 // gl_factory.h. | |
215 static scoped_refptr<GLSurface> CreateOffscreenGLSurface( | |
216 const gfx::Size& size); | |
217 | |
218 static GLSurface* GetCurrent(); | 196 static GLSurface* GetCurrent(); |
219 | 197 |
220 // Called when the swap interval for the associated context changes. | 198 // Called when the swap interval for the associated context changes. |
221 virtual void OnSetSwapInterval(int interval); | 199 virtual void OnSetSwapInterval(int interval); |
222 | 200 |
223 protected: | 201 protected: |
224 virtual ~GLSurface(); | 202 virtual ~GLSurface(); |
225 | 203 |
226 static void SetCurrent(GLSurface* surface); | 204 static void SetCurrent(GLSurface* surface); |
227 | 205 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 264 |
287 protected: | 265 protected: |
288 ~GLSurfaceAdapter() override; | 266 ~GLSurfaceAdapter() override; |
289 | 267 |
290 private: | 268 private: |
291 scoped_refptr<GLSurface> surface_; | 269 scoped_refptr<GLSurface> surface_; |
292 | 270 |
293 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); | 271 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); |
294 }; | 272 }; |
295 | 273 |
| 274 // Wraps GLSurface in scoped_refptr and tries to initializes it. Returns a |
| 275 // scoped_refptr containing the initialized GLSurface or nullptr if |
| 276 // initialization fails. |
| 277 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurface( |
| 278 scoped_refptr<GLSurface> surface); |
| 279 |
296 } // namespace gl | 280 } // namespace gl |
297 | 281 |
298 #endif // UI_GL_GL_SURFACE_H_ | 282 #endif // UI_GL_GL_SURFACE_H_ |
OLD | NEW |