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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 virtual bool SupportsDCLayers() const; | 214 virtual bool SupportsDCLayers() const; |
215 | 215 |
216 // Set the rectangle that will be drawn into on the surface. | 216 // Set the rectangle that will be drawn into on the surface. |
217 virtual bool SetDrawRectangle(const gfx::Rect& rect); | 217 virtual bool SetDrawRectangle(const gfx::Rect& rect); |
218 | 218 |
219 // This is the amount by which the scissor and viewport rectangles should be | 219 // This is the amount by which the scissor and viewport rectangles should be |
220 // offset. | 220 // offset. |
221 virtual gfx::Vector2d GetDrawOffset() const; | 221 virtual gfx::Vector2d GetDrawOffset() const; |
222 | 222 |
| 223 // This waits until rendering work is complete enough that an OS snapshot |
| 224 // will capture the last swapped contents. A GL context must be current when |
| 225 // calling this. |
| 226 virtual void WaitForSnapshotRendering(); |
| 227 |
223 static GLSurface* GetCurrent(); | 228 static GLSurface* GetCurrent(); |
224 | 229 |
225 protected: | 230 protected: |
226 virtual ~GLSurface(); | 231 virtual ~GLSurface(); |
227 | 232 |
228 static void SetCurrent(GLSurface* surface); | 233 static void SetCurrent(GLSurface* surface); |
229 | 234 |
230 static bool ExtensionsContain(const char* extensions, const char* name); | 235 static bool ExtensionsContain(const char* extensions, const char* name); |
231 | 236 |
232 private: | 237 private: |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 const gfx::Rect& bounds_rect, | 290 const gfx::Rect& bounds_rect, |
286 const gfx::RectF& crop_rect) override; | 291 const gfx::RectF& crop_rect) override; |
287 bool ScheduleDCLayer(const ui::DCRendererLayerParams& params) override; | 292 bool ScheduleDCLayer(const ui::DCRendererLayerParams& params) override; |
288 bool SetEnableDCLayers(bool enable) override; | 293 bool SetEnableDCLayers(bool enable) override; |
289 bool IsSurfaceless() const override; | 294 bool IsSurfaceless() const override; |
290 bool FlipsVertically() const override; | 295 bool FlipsVertically() const override; |
291 bool BuffersFlipped() const override; | 296 bool BuffersFlipped() const override; |
292 bool SupportsDCLayers() const override; | 297 bool SupportsDCLayers() const override; |
293 bool SetDrawRectangle(const gfx::Rect& rect) override; | 298 bool SetDrawRectangle(const gfx::Rect& rect) override; |
294 gfx::Vector2d GetDrawOffset() const override; | 299 gfx::Vector2d GetDrawOffset() const override; |
| 300 void WaitForSnapshotRendering() override; |
295 | 301 |
296 GLSurface* surface() const { return surface_.get(); } | 302 GLSurface* surface() const { return surface_.get(); } |
297 | 303 |
298 protected: | 304 protected: |
299 ~GLSurfaceAdapter() override; | 305 ~GLSurfaceAdapter() override; |
300 | 306 |
301 private: | 307 private: |
302 scoped_refptr<GLSurface> surface_; | 308 scoped_refptr<GLSurface> surface_; |
303 | 309 |
304 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); | 310 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); |
305 }; | 311 }; |
306 | 312 |
307 // Wraps GLSurface in scoped_refptr and tries to initializes it. Returns a | 313 // Wraps GLSurface in scoped_refptr and tries to initializes it. Returns a |
308 // scoped_refptr containing the initialized GLSurface or nullptr if | 314 // scoped_refptr containing the initialized GLSurface or nullptr if |
309 // initialization fails. | 315 // initialization fails. |
310 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurface( | 316 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurface( |
311 scoped_refptr<GLSurface> surface); | 317 scoped_refptr<GLSurface> surface); |
312 | 318 |
313 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurfaceWithFormat( | 319 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurfaceWithFormat( |
314 scoped_refptr<GLSurface> surface, GLSurfaceFormat format); | 320 scoped_refptr<GLSurface> surface, GLSurfaceFormat format); |
315 | 321 |
316 } // namespace gl | 322 } // namespace gl |
317 | 323 |
318 #endif // UI_GL_GL_SURFACE_H_ | 324 #endif // UI_GL_GL_SURFACE_H_ |
OLD | NEW |