| 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_CONTEXT_H_ | 5 #ifndef UI_GL_GL_CONTEXT_H_ |
| 6 #define UI_GL_GL_CONTEXT_H_ | 6 #define UI_GL_GL_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/cancelable_callback.h" | 11 #include "base/cancelable_callback.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/synchronization/cancellation_flag.h" | 15 #include "base/synchronization/cancellation_flag.h" |
| 16 #include "ui/gl/gl_share_group.h" | 16 #include "ui/gl/gl_share_group.h" |
| 17 #include "ui/gl/gl_state_restorer.h" | 17 #include "ui/gl/gl_state_restorer.h" |
| 18 #include "ui/gl/gpu_preference.h" | 18 #include "ui/gl/gpu_preference.h" |
| 19 | 19 |
| 20 namespace gl { |
| 21 class YUVToRGBConverter; |
| 22 } // namespace gl |
| 23 |
| 20 namespace gpu { | 24 namespace gpu { |
| 21 class GLContextVirtual; | 25 class GLContextVirtual; |
| 22 } // namespace gpu | 26 } // namespace gpu |
| 23 | 27 |
| 24 namespace gfx { | 28 namespace gfx { |
| 25 | 29 |
| 26 class GLSurface; | 30 class GLSurface; |
| 27 class GPUTiming; | 31 class GPUTiming; |
| 28 class GPUTimingClient; | 32 class GPUTimingClient; |
| 29 class VirtualGLApi; | 33 class VirtualGLApi; |
| 30 struct GLVersionInfo; | 34 struct GLVersionInfo; |
| 31 | 35 |
| 32 | |
| 33 // Encapsulates an OpenGL context, hiding platform specific management. | 36 // Encapsulates an OpenGL context, hiding platform specific management. |
| 34 class GL_EXPORT GLContext : public base::RefCounted<GLContext> { | 37 class GL_EXPORT GLContext : public base::RefCounted<GLContext> { |
| 35 public: | 38 public: |
| 36 explicit GLContext(GLShareGroup* share_group); | 39 explicit GLContext(GLShareGroup* share_group); |
| 37 | 40 |
| 38 // Initializes the GL context to be compatible with the given surface. The GL | 41 // Initializes the GL context to be compatible with the given surface. The GL |
| 39 // context can be made with other surface's of the same type. The compatible | 42 // context can be made with other surface's of the same type. The compatible |
| 40 // surface is only needed for certain platforms like WGL, OSMesa and GLX. It | 43 // surface is only needed for certain platforms like WGL, OSMesa and GLX. It |
| 41 // should be specific for all platforms though. | 44 // should be specific for all platforms though. |
| 42 virtual bool Initialize( | 45 virtual bool Initialize( |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // Notify this context that |virtual_context|, that was using us, is | 123 // Notify this context that |virtual_context|, that was using us, is |
| 121 // being released or destroyed. | 124 // being released or destroyed. |
| 122 void OnReleaseVirtuallyCurrent(GLContext* virtual_context); | 125 void OnReleaseVirtuallyCurrent(GLContext* virtual_context); |
| 123 | 126 |
| 124 // Returns the GL version string. The context must be current. | 127 // Returns the GL version string. The context must be current. |
| 125 virtual std::string GetGLVersion(); | 128 virtual std::string GetGLVersion(); |
| 126 | 129 |
| 127 // Returns the GL renderer string. The context must be current. | 130 // Returns the GL renderer string. The context must be current. |
| 128 virtual std::string GetGLRenderer(); | 131 virtual std::string GetGLRenderer(); |
| 129 | 132 |
| 133 // Returns a helper structure to convert YUV textures to RGB textures. |
| 134 virtual gl::YUVToRGBConverter* GetYUVToRGBConverter(); |
| 135 |
| 130 protected: | 136 protected: |
| 131 virtual ~GLContext(); | 137 virtual ~GLContext(); |
| 132 | 138 |
| 133 // Will release the current context when going out of scope, unless canceled. | 139 // Will release the current context when going out of scope, unless canceled. |
| 134 class ScopedReleaseCurrent { | 140 class ScopedReleaseCurrent { |
| 135 public: | 141 public: |
| 136 ScopedReleaseCurrent(); | 142 ScopedReleaseCurrent(); |
| 137 ~ScopedReleaseCurrent(); | 143 ~ScopedReleaseCurrent(); |
| 138 | 144 |
| 139 void Cancel(); | 145 void Cancel(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 void SetCurrent(GLSurface* surface) override; | 192 void SetCurrent(GLSurface* surface) override; |
| 187 | 193 |
| 188 private: | 194 private: |
| 189 scoped_ptr<gfx::GPUTiming> gpu_timing_; | 195 scoped_ptr<gfx::GPUTiming> gpu_timing_; |
| 190 DISALLOW_COPY_AND_ASSIGN(GLContextReal); | 196 DISALLOW_COPY_AND_ASSIGN(GLContextReal); |
| 191 }; | 197 }; |
| 192 | 198 |
| 193 } // namespace gfx | 199 } // namespace gfx |
| 194 | 200 |
| 195 #endif // UI_GL_GL_CONTEXT_H_ | 201 #endif // UI_GL_GL_CONTEXT_H_ |
| OLD | NEW |