| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_GFX_GL_GL_SURFACE_H_ | 5 #ifndef UI_GFX_GL_GL_SURFACE_H_ |
| 6 #define UI_GFX_GL_GL_SURFACE_H_ | 6 #define UI_GFX_GL_GL_SURFACE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
| 11 #include "ui/gfx/size.h" | 11 #include "ui/gfx/size.h" |
| 12 | 12 |
| 13 namespace gfx { | 13 namespace gfx { |
| 14 | 14 |
| 15 // Encapsulates a surface that can be rendered to with GL, hiding platform | 15 // Encapsulates a surface that can be rendered to with GL, hiding platform |
| 16 // specific management. | 16 // specific management. |
| 17 class GLSurface { | 17 class GLSurface { |
| 18 public: | 18 public: |
| 19 GLSurface() {} | 19 GLSurface() {} |
| 20 virtual ~GLSurface() {} | 20 virtual ~GLSurface() {} |
| 21 | 21 |
| 22 // (Re)create the surface. TODO(apatrick): This is an ugly hack to allow the |
| 23 // EGL surface associated to be recreated without destroying the associated |
| 24 // context. The implementation of this function for other GLSurface derived |
| 25 // classes is in a pending changelist. |
| 26 virtual bool Initialize() { return true; } |
| 27 |
| 22 // Destroys the surface. | 28 // Destroys the surface. |
| 23 virtual void Destroy() = 0; | 29 virtual void Destroy() = 0; |
| 24 | 30 |
| 25 // Returns true if this surface is offscreen. | 31 // Returns true if this surface is offscreen. |
| 26 virtual bool IsOffscreen() = 0; | 32 virtual bool IsOffscreen() = 0; |
| 27 | 33 |
| 28 // Swaps front and back buffers. This has no effect for off-screen | 34 // Swaps front and back buffers. This has no effect for off-screen |
| 29 // contexts. | 35 // contexts. |
| 30 virtual bool SwapBuffers() = 0; | 36 virtual bool SwapBuffers() = 0; |
| 31 | 37 |
| 32 // Get the size of the surface. | 38 // Get the size of the surface. |
| 33 virtual gfx::Size GetSize() = 0; | 39 virtual gfx::Size GetSize() = 0; |
| 34 | 40 |
| 35 // Get the underlying platform specific surface "handle". | 41 // Get the underlying platform specific surface "handle". |
| 36 virtual void* GetHandle() = 0; | 42 virtual void* GetHandle() = 0; |
| 37 | 43 |
| 38 // Returns the internal frame buffer object name if the surface is backed by | 44 // Returns the internal frame buffer object name if the surface is backed by |
| 39 // FBO. Otherwise returns 0. | 45 // FBO. Otherwise returns 0. |
| 40 virtual unsigned int GetBackingFrameBufferObject(); | 46 virtual unsigned int GetBackingFrameBufferObject(); |
| 41 | 47 |
| 42 private: | 48 private: |
| 43 DISALLOW_COPY_AND_ASSIGN(GLSurface); | 49 DISALLOW_COPY_AND_ASSIGN(GLSurface); |
| 44 }; | 50 }; |
| 45 | 51 |
| 46 } // namespace gfx | 52 } // namespace gfx |
| 47 | 53 |
| 48 #endif // UI_GFX_GL_GL_SURFACE_H_ | 54 #endif // UI_GFX_GL_GL_SURFACE_H_ |
| OLD | NEW |