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 <memory> | 10 #include <memory> |
(...skipping 15 matching lines...) Expand all Loading... |
26 bool Initialize(GLSurface* compatible_surface, | 26 bool Initialize(GLSurface* compatible_surface, |
27 const GLContextAttribs& attribs) override; | 27 const GLContextAttribs& attribs) override; |
28 bool MakeCurrent(GLSurface* surface) override; | 28 bool MakeCurrent(GLSurface* surface) override; |
29 void ReleaseCurrent(GLSurface* surface) override; | 29 void ReleaseCurrent(GLSurface* surface) override; |
30 bool IsCurrent(GLSurface* surface) override; | 30 bool IsCurrent(GLSurface* surface) override; |
31 void* GetHandle() override; | 31 void* GetHandle() override; |
32 void OnSetSwapInterval(int interval) override; | 32 void OnSetSwapInterval(int interval) override; |
33 void SetSafeToForceGpuSwitch() override; | 33 void SetSafeToForceGpuSwitch() override; |
34 bool ForceGpuSwitchIfNeeded() override; | 34 bool ForceGpuSwitchIfNeeded() override; |
35 YUVToRGBConverter* GetYUVToRGBConverter() override; | 35 YUVToRGBConverter* GetYUVToRGBConverter() override; |
| 36 void SetPerformancePreference(GpuPerformancePreference pref) override; |
36 | 37 |
37 protected: | 38 protected: |
38 ~GLContextCGL() override; | 39 ~GLContextCGL() override; |
39 | 40 |
40 private: | 41 private: |
41 void Destroy(); | 42 void Destroy(); |
42 GpuPreference GetGpuPreference(); | 43 GpuPreference GetGpuPreference(); |
43 | 44 |
| 45 bool AllocateDiscretePixelFormat(); |
| 46 void ReleaseDiscretePixelFormat(); |
| 47 |
44 void* context_; | 48 void* context_; |
45 GpuPreference gpu_preference_; | 49 GpuPreference gpu_preference_; |
46 std::unique_ptr<YUVToRGBConverter> yuv_to_rgb_converter_; | 50 std::unique_ptr<YUVToRGBConverter> yuv_to_rgb_converter_; |
47 | 51 |
48 CGLPixelFormatObj discrete_pixelformat_; | 52 CGLPixelFormatObj discrete_pixelformat_; |
49 | 53 |
50 int screen_; | 54 int screen_; |
51 int renderer_id_; | 55 int renderer_id_; |
52 bool safe_to_force_gpu_switch_; | 56 bool safe_to_force_gpu_switch_; |
53 | 57 |
54 DISALLOW_COPY_AND_ASSIGN(GLContextCGL); | 58 DISALLOW_COPY_AND_ASSIGN(GLContextCGL); |
55 }; | 59 }; |
56 | 60 |
57 } // namespace gl | 61 } // namespace gl |
58 | 62 |
59 #endif // UI_GL_GL_CONTEXT_CGL_H_ | 63 #endif // UI_GL_GL_CONTEXT_CGL_H_ |
OLD | NEW |