| 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_CONTEXT_H_ | 5 #ifndef UI_GFX_GL_GL_CONTEXT_H_ |
| 6 #define UI_GFX_GL_GL_CONTEXT_H_ | 6 #define UI_GFX_GL_GL_CONTEXT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
| 13 #include "ui/gfx/size.h" | 13 #include "ui/gfx/size.h" |
| 14 | 14 |
| 15 namespace gfx { | 15 namespace gfx { |
| 16 | 16 |
| 17 class GLSurface; |
| 18 |
| 17 // Encapsulates an OpenGL context, hiding platform specific management. | 19 // Encapsulates an OpenGL context, hiding platform specific management. |
| 18 class GLContext { | 20 class GLContext { |
| 19 public: | 21 public: |
| 20 GLContext() {} | 22 GLContext() {} |
| 21 virtual ~GLContext() {} | 23 virtual ~GLContext() {} |
| 22 | 24 |
| 23 // Destroys the GL context. | 25 // Destroys the GL context. |
| 24 virtual void Destroy() = 0; | 26 virtual void Destroy() = 0; |
| 25 | 27 |
| 26 // Makes the GL context current on the current thread. | 28 // Makes the GL context current on the current thread. |
| 27 virtual bool MakeCurrent() = 0; | 29 virtual bool MakeCurrent() = 0; |
| 28 | 30 |
| 31 // Releases this GL context as current on the current thread. TODO(apatrick): |
| 32 // implement this in the other GLContexts. |
| 33 virtual void ReleaseCurrent(); |
| 34 |
| 29 // Returns true if this context is current. | 35 // Returns true if this context is current. |
| 30 virtual bool IsCurrent() = 0; | 36 virtual bool IsCurrent() = 0; |
| 31 | 37 |
| 32 // Returns true if this context is offscreen. | 38 // Returns true if this context is offscreen. |
| 33 virtual bool IsOffscreen() = 0; | 39 virtual bool IsOffscreen() = 0; |
| 34 | 40 |
| 35 // Swaps front and back buffers. This has no effect for off-screen | 41 // Swaps front and back buffers. This has no effect for off-screen |
| 36 // contexts. | 42 // contexts. |
| 37 virtual bool SwapBuffers() = 0; | 43 virtual bool SwapBuffers() = 0; |
| 38 | 44 |
| 39 // Get the size of the back buffer. | 45 // Get the size of the back buffer. |
| 40 virtual gfx::Size GetSize() = 0; | 46 virtual gfx::Size GetSize() = 0; |
| 41 | 47 |
| 48 // Get the surface. TODO(apatrick): remove this when contexts are split from |
| 49 // surfaces. |
| 50 virtual GLSurface* GetSurface(); |
| 51 |
| 42 // Get the underlying platform specific GL context "handle". | 52 // Get the underlying platform specific GL context "handle". |
| 43 virtual void* GetHandle() = 0; | 53 virtual void* GetHandle() = 0; |
| 44 | 54 |
| 45 // Set swap interval. This context must be current. | 55 // Set swap interval. This context must be current. |
| 46 virtual void SetSwapInterval(int interval) = 0; | 56 virtual void SetSwapInterval(int interval) = 0; |
| 47 | 57 |
| 48 // Returns the internal frame buffer object name if the context is backed by | 58 // Returns the internal frame buffer object name if the context is backed by |
| 49 // FBO. Otherwise returns 0. | 59 // FBO. Otherwise returns 0. |
| 50 virtual unsigned int GetBackingFrameBufferObject(); | 60 virtual unsigned int GetBackingFrameBufferObject(); |
| 51 | 61 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 75 protected: | 85 protected: |
| 76 bool InitializeCommon(); | 86 bool InitializeCommon(); |
| 77 | 87 |
| 78 private: | 88 private: |
| 79 DISALLOW_COPY_AND_ASSIGN(GLContext); | 89 DISALLOW_COPY_AND_ASSIGN(GLContext); |
| 80 }; | 90 }; |
| 81 | 91 |
| 82 } // namespace gfx | 92 } // namespace gfx |
| 83 | 93 |
| 84 #endif // UI_GFX_GL_GL_CONTEXT_H_ | 94 #endif // UI_GFX_GL_GL_CONTEXT_H_ |
| OLD | NEW |