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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // 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 |
79 // contexts. | 79 // contexts. |
80 virtual gfx::SwapResult SwapBuffers() = 0; | 80 virtual gfx::SwapResult SwapBuffers() = 0; |
81 | 81 |
82 // Get the size of the surface. | 82 // Get the size of the surface. |
83 virtual gfx::Size GetSize() = 0; | 83 virtual gfx::Size GetSize() = 0; |
84 | 84 |
85 // Get the underlying platform specific surface "handle". | 85 // Get the underlying platform specific surface "handle". |
86 virtual void* GetHandle() = 0; | 86 virtual void* GetHandle() = 0; |
87 | 87 |
| 88 // Returns whether or not the surface supports SwapBuffersWithDamage |
| 89 virtual bool SupportsSwapBuffersWithDamage(); |
| 90 |
88 // Returns whether or not the surface supports PostSubBuffer. | 91 // Returns whether or not the surface supports PostSubBuffer. |
89 virtual bool SupportsPostSubBuffer(); | 92 virtual bool SupportsPostSubBuffer(); |
90 | 93 |
91 // Returns whether or not the surface supports CommitOverlayPlanes. | 94 // Returns whether or not the surface supports CommitOverlayPlanes. |
92 virtual bool SupportsCommitOverlayPlanes(); | 95 virtual bool SupportsCommitOverlayPlanes(); |
93 | 96 |
94 // Returns whether SwapBuffersAsync() is supported. | 97 // Returns whether SwapBuffersAsync() is supported. |
95 virtual bool SupportsAsyncSwap(); | 98 virtual bool SupportsAsyncSwap(); |
96 | 99 |
97 // Returns the internal frame buffer object name if the surface is backed by | 100 // Returns the internal frame buffer object name if the surface is backed by |
98 // FBO. Otherwise returns 0. | 101 // FBO. Otherwise returns 0. |
99 virtual unsigned int GetBackingFramebufferObject(); | 102 virtual unsigned int GetBackingFramebufferObject(); |
100 | 103 |
101 typedef base::Callback<void(gfx::SwapResult)> SwapCompletionCallback; | 104 typedef base::Callback<void(gfx::SwapResult)> SwapCompletionCallback; |
102 // Swaps front and back buffers. This has no effect for off-screen | 105 // Swaps front and back buffers. This has no effect for off-screen |
103 // contexts. On some platforms, we want to send SwapBufferAck only after the | 106 // contexts. On some platforms, we want to send SwapBufferAck only after the |
104 // surface is displayed on screen. The callback can be used to delay sending | 107 // surface is displayed on screen. The callback can be used to delay sending |
105 // SwapBufferAck till that data is available. The callback should be run on | 108 // SwapBufferAck till that data is available. The callback should be run on |
106 // the calling thread (i.e. same thread SwapBuffersAsync is called) | 109 // the calling thread (i.e. same thread SwapBuffersAsync is called) |
107 virtual void SwapBuffersAsync(const SwapCompletionCallback& callback); | 110 virtual void SwapBuffersAsync(const SwapCompletionCallback& callback); |
108 | 111 |
| 112 // Swap buffers with damage rect. |
| 113 virtual gfx::SwapResult SwapBuffersWithDamage(int x, |
| 114 int y, |
| 115 int width, |
| 116 int height); |
| 117 |
109 // Copy part of the backbuffer to the frontbuffer. | 118 // Copy part of the backbuffer to the frontbuffer. |
110 virtual gfx::SwapResult PostSubBuffer(int x, int y, int width, int height); | 119 virtual gfx::SwapResult PostSubBuffer(int x, int y, int width, int height); |
111 | 120 |
112 // Copy part of the backbuffer to the frontbuffer. On some platforms, we want | 121 // Copy part of the backbuffer to the frontbuffer. On some platforms, we want |
113 // to send SwapBufferAck only after the surface is displayed on screen. The | 122 // to send SwapBufferAck only after the surface is displayed on screen. The |
114 // callback can be used to delay sending SwapBufferAck till that data is | 123 // callback can be used to delay sending SwapBufferAck till that data is |
115 // available. The callback should be run on the calling thread (i.e. same | 124 // available. The callback should be run on the calling thread (i.e. same |
116 // thread PostSubBufferAsync is called) | 125 // thread PostSubBufferAsync is called) |
117 virtual void PostSubBufferAsync(int x, | 126 virtual void PostSubBufferAsync(int x, |
118 int y, | 127 int y, |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 286 |
278 // Wraps GLSurface in scoped_refptr and tries to initializes it. Returns a | 287 // Wraps GLSurface in scoped_refptr and tries to initializes it. Returns a |
279 // scoped_refptr containing the initialized GLSurface or nullptr if | 288 // scoped_refptr containing the initialized GLSurface or nullptr if |
280 // initialization fails. | 289 // initialization fails. |
281 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurface( | 290 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurface( |
282 scoped_refptr<GLSurface> surface); | 291 scoped_refptr<GLSurface> surface); |
283 | 292 |
284 } // namespace gl | 293 } // namespace gl |
285 | 294 |
286 #endif // UI_GL_GL_SURFACE_H_ | 295 #endif // UI_GL_GL_SURFACE_H_ |
OLD | NEW |