| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // Swaps front and back buffers. This has no effect for off-screen | 73 // Swaps front and back buffers. This has no effect for off-screen |
| 74 // contexts. | 74 // contexts. |
| 75 virtual gfx::SwapResult SwapBuffers() = 0; | 75 virtual gfx::SwapResult SwapBuffers() = 0; |
| 76 | 76 |
| 77 // Get the size of the surface. | 77 // Get the size of the surface. |
| 78 virtual gfx::Size GetSize() = 0; | 78 virtual gfx::Size GetSize() = 0; |
| 79 | 79 |
| 80 // Get the underlying platform specific surface "handle". | 80 // Get the underlying platform specific surface "handle". |
| 81 virtual void* GetHandle() = 0; | 81 virtual void* GetHandle() = 0; |
| 82 | 82 |
| 83 // Returns whether or not the surface supports SwapBuffersWithDamage | 83 // Returns whether or not the surface supports SwapBuffersWithBounds |
| 84 virtual bool SupportsSwapBuffersWithDamage(); | 84 virtual bool SupportsSwapBuffersWithBounds(); |
| 85 | 85 |
| 86 // Returns whether or not the surface supports PostSubBuffer. | 86 // Returns whether or not the surface supports PostSubBuffer. |
| 87 virtual bool SupportsPostSubBuffer(); | 87 virtual bool SupportsPostSubBuffer(); |
| 88 | 88 |
| 89 // Returns whether or not the surface supports CommitOverlayPlanes. | 89 // Returns whether or not the surface supports CommitOverlayPlanes. |
| 90 virtual bool SupportsCommitOverlayPlanes(); | 90 virtual bool SupportsCommitOverlayPlanes(); |
| 91 | 91 |
| 92 // Returns whether SwapBuffersAsync() is supported. | 92 // Returns whether SwapBuffersAsync() is supported. |
| 93 virtual bool SupportsAsyncSwap(); | 93 virtual bool SupportsAsyncSwap(); |
| 94 | 94 |
| 95 // Returns the internal frame buffer object name if the surface is backed by | 95 // Returns the internal frame buffer object name if the surface is backed by |
| 96 // FBO. Otherwise returns 0. | 96 // FBO. Otherwise returns 0. |
| 97 virtual unsigned int GetBackingFramebufferObject(); | 97 virtual unsigned int GetBackingFramebufferObject(); |
| 98 | 98 |
| 99 typedef base::Callback<void(gfx::SwapResult)> SwapCompletionCallback; | 99 typedef base::Callback<void(gfx::SwapResult)> SwapCompletionCallback; |
| 100 // Swaps front and back buffers. This has no effect for off-screen | 100 // Swaps front and back buffers. This has no effect for off-screen |
| 101 // contexts. On some platforms, we want to send SwapBufferAck only after the | 101 // contexts. On some platforms, we want to send SwapBufferAck only after the |
| 102 // surface is displayed on screen. The callback can be used to delay sending | 102 // surface is displayed on screen. The callback can be used to delay sending |
| 103 // SwapBufferAck till that data is available. The callback should be run on | 103 // SwapBufferAck till that data is available. The callback should be run on |
| 104 // the calling thread (i.e. same thread SwapBuffersAsync is called) | 104 // the calling thread (i.e. same thread SwapBuffersAsync is called) |
| 105 virtual void SwapBuffersAsync(const SwapCompletionCallback& callback); | 105 virtual void SwapBuffersAsync(const SwapCompletionCallback& callback); |
| 106 | 106 |
| 107 // Swap buffers with damage rect. | 107 // Swap buffers with content bounds. |
| 108 virtual gfx::SwapResult SwapBuffersWithDamage(int x, | 108 virtual gfx::SwapResult SwapBuffersWithBounds( |
| 109 int y, | 109 const std::vector<gfx::Rect>& rects); |
| 110 int width, | |
| 111 int height); | |
| 112 | 110 |
| 113 // Copy part of the backbuffer to the frontbuffer. | 111 // Copy part of the backbuffer to the frontbuffer. |
| 114 virtual gfx::SwapResult PostSubBuffer(int x, int y, int width, int height); | 112 virtual gfx::SwapResult PostSubBuffer(int x, int y, int width, int height); |
| 115 | 113 |
| 116 // Copy part of the backbuffer to the frontbuffer. On some platforms, we want | 114 // Copy part of the backbuffer to the frontbuffer. On some platforms, we want |
| 117 // to send SwapBufferAck only after the surface is displayed on screen. The | 115 // to send SwapBufferAck only after the surface is displayed on screen. The |
| 118 // callback can be used to delay sending SwapBufferAck till that data is | 116 // callback can be used to delay sending SwapBufferAck till that data is |
| 119 // available. The callback should be run on the calling thread (i.e. same | 117 // available. The callback should be run on the calling thread (i.e. same |
| 120 // thread PostSubBufferAsync is called) | 118 // thread PostSubBufferAsync is called) |
| 121 virtual void PostSubBufferAsync(int x, | 119 virtual void PostSubBufferAsync(int x, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 bool Initialize(GLSurfaceFormat format) override; | 231 bool Initialize(GLSurfaceFormat format) override; |
| 234 void Destroy() override; | 232 void Destroy() override; |
| 235 bool Resize(const gfx::Size& size, | 233 bool Resize(const gfx::Size& size, |
| 236 float scale_factor, | 234 float scale_factor, |
| 237 bool has_alpha) override; | 235 bool has_alpha) override; |
| 238 bool Recreate() override; | 236 bool Recreate() override; |
| 239 bool DeferDraws() override; | 237 bool DeferDraws() override; |
| 240 bool IsOffscreen() override; | 238 bool IsOffscreen() override; |
| 241 gfx::SwapResult SwapBuffers() override; | 239 gfx::SwapResult SwapBuffers() override; |
| 242 void SwapBuffersAsync(const SwapCompletionCallback& callback) override; | 240 void SwapBuffersAsync(const SwapCompletionCallback& callback) override; |
| 243 gfx::SwapResult SwapBuffersWithDamage(int x, | 241 gfx::SwapResult SwapBuffersWithBounds( |
| 244 int y, | 242 const std::vector<gfx::Rect>& rects) override; |
| 245 int width, | |
| 246 int height) override; | |
| 247 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; | 243 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; |
| 248 void PostSubBufferAsync(int x, | 244 void PostSubBufferAsync(int x, |
| 249 int y, | 245 int y, |
| 250 int width, | 246 int width, |
| 251 int height, | 247 int height, |
| 252 const SwapCompletionCallback& callback) override; | 248 const SwapCompletionCallback& callback) override; |
| 253 gfx::SwapResult CommitOverlayPlanes() override; | 249 gfx::SwapResult CommitOverlayPlanes() override; |
| 254 void CommitOverlayPlanesAsync( | 250 void CommitOverlayPlanesAsync( |
| 255 const SwapCompletionCallback& callback) override; | 251 const SwapCompletionCallback& callback) override; |
| 256 bool SupportsSwapBuffersWithDamage() override; | 252 bool SupportsSwapBuffersWithBounds() override; |
| 257 bool SupportsPostSubBuffer() override; | 253 bool SupportsPostSubBuffer() override; |
| 258 bool SupportsCommitOverlayPlanes() override; | 254 bool SupportsCommitOverlayPlanes() override; |
| 259 bool SupportsAsyncSwap() override; | 255 bool SupportsAsyncSwap() override; |
| 260 gfx::Size GetSize() override; | 256 gfx::Size GetSize() override; |
| 261 void* GetHandle() override; | 257 void* GetHandle() override; |
| 262 unsigned int GetBackingFramebufferObject() override; | 258 unsigned int GetBackingFramebufferObject() override; |
| 263 bool OnMakeCurrent(GLContext* context) override; | 259 bool OnMakeCurrent(GLContext* context) override; |
| 264 bool SetBackbufferAllocation(bool allocated) override; | 260 bool SetBackbufferAllocation(bool allocated) override; |
| 265 void SetFrontbufferAllocation(bool allocated) override; | 261 void SetFrontbufferAllocation(bool allocated) override; |
| 266 void* GetShareHandle() override; | 262 void* GetShareHandle() override; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 294 // initialization fails. | 290 // initialization fails. |
| 295 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurface( | 291 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurface( |
| 296 scoped_refptr<GLSurface> surface); | 292 scoped_refptr<GLSurface> surface); |
| 297 | 293 |
| 298 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurfaceWithFormat( | 294 GL_EXPORT scoped_refptr<GLSurface> InitializeGLSurfaceWithFormat( |
| 299 scoped_refptr<GLSurface> surface, GLSurfaceFormat format); | 295 scoped_refptr<GLSurface> surface, GLSurfaceFormat format); |
| 300 | 296 |
| 301 } // namespace gl | 297 } // namespace gl |
| 302 | 298 |
| 303 #endif // UI_GL_GL_SURFACE_H_ | 299 #endif // UI_GL_GL_SURFACE_H_ |
| OLD | NEW |