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" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
14 #include "ui/gfx/geometry/rect_f.h" | 14 #include "ui/gfx/geometry/rect_f.h" |
15 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
16 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
17 #include "ui/gfx/overlay_transform.h" | 17 #include "ui/gfx/overlay_transform.h" |
| 18 #include "ui/gfx/swap_result.h" |
18 #include "ui/gl/gl_export.h" | 19 #include "ui/gl/gl_export.h" |
19 #include "ui/gl/gl_implementation.h" | 20 #include "ui/gl/gl_implementation.h" |
20 | 21 |
21 namespace gfx { | 22 namespace gfx { |
22 | 23 |
23 class GLContext; | 24 class GLContext; |
24 class GLImage; | 25 class GLImage; |
25 class VSyncProvider; | 26 class VSyncProvider; |
26 | 27 |
27 // Encapsulates a surface that can be rendered to with GL, hiding platform | 28 // Encapsulates a surface that can be rendered to with GL, hiding platform |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // Get the underlying platform specific surface "handle". | 67 // Get the underlying platform specific surface "handle". |
67 virtual void* GetHandle() = 0; | 68 virtual void* GetHandle() = 0; |
68 | 69 |
69 // Returns whether or not the surface supports PostSubBuffer. | 70 // Returns whether or not the surface supports PostSubBuffer. |
70 virtual bool SupportsPostSubBuffer(); | 71 virtual bool SupportsPostSubBuffer(); |
71 | 72 |
72 // Returns the internal frame buffer object name if the surface is backed by | 73 // Returns the internal frame buffer object name if the surface is backed by |
73 // FBO. Otherwise returns 0. | 74 // FBO. Otherwise returns 0. |
74 virtual unsigned int GetBackingFrameBufferObject(); | 75 virtual unsigned int GetBackingFrameBufferObject(); |
75 | 76 |
76 typedef base::Callback<void()> SwapCompletionCallback; | 77 typedef base::Callback<void(SwapResult)> SwapCompletionCallback; |
77 // Swaps front and back buffers. This has no effect for off-screen | 78 // Swaps front and back buffers. This has no effect for off-screen |
78 // contexts. On some platforms, we want to send SwapBufferAck only after the | 79 // contexts. On some platforms, we want to send SwapBufferAck only after the |
79 // surface is displayed on screen. The callback can be used to delay sending | 80 // surface is displayed on screen. The callback can be used to delay sending |
80 // SwapBufferAck till that data is available. The callback should be run on | 81 // SwapBufferAck till that data is available. The callback should be run on |
81 // the calling thread (i.e. same thread SwapBuffersAsync is called) | 82 // the calling thread (i.e. same thread SwapBuffersAsync is called) |
82 virtual bool SwapBuffersAsync(const SwapCompletionCallback& callback); | 83 virtual bool SwapBuffersAsync(const SwapCompletionCallback& callback); |
83 | 84 |
84 // Copy part of the backbuffer to the frontbuffer. | 85 // Copy part of the backbuffer to the frontbuffer. |
85 virtual bool PostSubBuffer(int x, int y, int width, int height); | 86 virtual bool PostSubBuffer(int x, int y, int width, int height); |
86 | 87 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 239 |
239 private: | 240 private: |
240 scoped_refptr<GLSurface> surface_; | 241 scoped_refptr<GLSurface> surface_; |
241 | 242 |
242 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); | 243 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); |
243 }; | 244 }; |
244 | 245 |
245 } // namespace gfx | 246 } // namespace gfx |
246 | 247 |
247 #endif // UI_GL_GL_SURFACE_H_ | 248 #endif // UI_GL_GL_SURFACE_H_ |
OLD | NEW |