| 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_CGL_H_ | 5 #ifndef UI_GL_GL_CONTEXT_CGL_H_ |
| 6 #define UI_GL_GL_CONTEXT_CGL_H_ | 6 #define UI_GL_GL_CONTEXT_CGL_H_ |
| 7 | 7 |
| 8 #include <OpenGL/CGLTypes.h> | 8 #include <OpenGL/CGLTypes.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 11 #include "ui/gl/gl_context.h" | 12 #include "ui/gl/gl_context.h" |
| 12 | 13 |
| 13 namespace gfx { | 14 namespace gfx { |
| 14 | 15 |
| 15 class GLSurface; | 16 class GLSurface; |
| 16 | 17 |
| 17 // Encapsulates a CGL OpenGL context. | 18 // Encapsulates a CGL OpenGL context. |
| 18 class GLContextCGL : public GLContextReal { | 19 class GLContextCGL : public GLContextReal { |
| 19 public: | 20 public: |
| 20 explicit GLContextCGL(GLShareGroup* share_group); | 21 explicit GLContextCGL(GLShareGroup* share_group); |
| 21 | 22 |
| 22 // Implement GLContext. | 23 // Implement GLContext. |
| 23 bool Initialize(GLSurface* compatible_surface, | 24 bool Initialize(GLSurface* compatible_surface, |
| 24 GpuPreference gpu_preference) override; | 25 GpuPreference gpu_preference) override; |
| 25 bool MakeCurrent(GLSurface* surface) override; | 26 bool MakeCurrent(GLSurface* surface) override; |
| 26 void ReleaseCurrent(GLSurface* surface) override; | 27 void ReleaseCurrent(GLSurface* surface) override; |
| 27 bool IsCurrent(GLSurface* surface) override; | 28 bool IsCurrent(GLSurface* surface) override; |
| 28 void* GetHandle() override; | 29 void* GetHandle() override; |
| 29 void OnSetSwapInterval(int interval) override; | 30 void OnSetSwapInterval(int interval) override; |
| 30 void SetSafeToForceGpuSwitch() override; | 31 void SetSafeToForceGpuSwitch() override; |
| 31 bool ForceGpuSwitchIfNeeded() override; | 32 bool ForceGpuSwitchIfNeeded() override; |
| 33 gl::YUVToRGBConverter* GetYUVToRGBConverter() override; |
| 32 | 34 |
| 33 protected: | 35 protected: |
| 34 ~GLContextCGL() override; | 36 ~GLContextCGL() override; |
| 35 | 37 |
| 36 private: | 38 private: |
| 37 void Destroy(); | 39 void Destroy(); |
| 38 GpuPreference GetGpuPreference(); | 40 GpuPreference GetGpuPreference(); |
| 39 | 41 |
| 40 void* context_; | 42 void* context_; |
| 41 GpuPreference gpu_preference_; | 43 GpuPreference gpu_preference_; |
| 44 scoped_ptr<gl::YUVToRGBConverter> yuv_to_rgb_converter_; |
| 42 | 45 |
| 43 CGLPixelFormatObj discrete_pixelformat_; | 46 CGLPixelFormatObj discrete_pixelformat_; |
| 44 | 47 |
| 45 int screen_; | 48 int screen_; |
| 46 int renderer_id_; | 49 int renderer_id_; |
| 47 bool safe_to_force_gpu_switch_; | 50 bool safe_to_force_gpu_switch_; |
| 48 | 51 |
| 49 DISALLOW_COPY_AND_ASSIGN(GLContextCGL); | 52 DISALLOW_COPY_AND_ASSIGN(GLContextCGL); |
| 50 }; | 53 }; |
| 51 | 54 |
| 52 } // namespace gfx | 55 } // namespace gfx |
| 53 | 56 |
| 54 #endif // UI_GL_GL_CONTEXT_CGL_H_ | 57 #endif // UI_GL_GL_CONTEXT_CGL_H_ |
| OLD | NEW |