| 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 #include "ui/gl/gl_wgl_api_implementation.h" | 5 #include "ui/gl/gl_wgl_api_implementation.h" |
| 6 #include "ui/gl/gl_implementation.h" | 6 #include "ui/gl/gl_implementation.h" |
| 7 | 7 |
| 8 namespace gfx { | 8 namespace gfx { |
| 9 | 9 |
| 10 RealWGLApi* g_real_wgl; | 10 RealWGLApi* g_real_wgl; |
| 11 | 11 |
| 12 void InitializeStaticGLBindingsWGL() { | 12 void InitializeStaticGLBindingsWGL() { |
| 13 g_driver_wgl.InitializeStaticBindings(); | 13 g_driver_wgl.InitializeStaticBindings(); |
| 14 if (!g_real_wgl) { | 14 if (!g_real_wgl) { |
| 15 g_real_wgl = new RealWGLApi(); | 15 g_real_wgl = new RealWGLApi(); |
| 16 } | 16 } |
| 17 g_real_wgl->Initialize(&g_driver_wgl); | 17 g_real_wgl->Initialize(&g_driver_wgl); |
| 18 g_current_wgl_context = g_real_wgl; | 18 g_current_wgl_context = g_real_wgl; |
| 19 g_driver_wgl.InitializeExtensionBindings(g_real_wgl->GetEnabledExtensions()); |
| 19 } | 20 } |
| 20 | 21 |
| 21 void InitializeDebugGLBindingsWGL() { | 22 void InitializeDebugGLBindingsWGL() { |
| 22 g_driver_wgl.InitializeDebugBindings(); | 23 g_driver_wgl.InitializeDebugBindings(); |
| 23 } | 24 } |
| 24 | 25 |
| 25 void ClearGLBindingsWGL() { | 26 void ClearGLBindingsWGL() { |
| 26 if (g_real_wgl) { | 27 if (g_real_wgl) { |
| 27 delete g_real_wgl; | 28 delete g_real_wgl; |
| 28 g_real_wgl = NULL; | 29 g_real_wgl = NULL; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 51 RealWGLApi::RealWGLApi() { | 52 RealWGLApi::RealWGLApi() { |
| 52 } | 53 } |
| 53 | 54 |
| 54 RealWGLApi::~RealWGLApi() { | 55 RealWGLApi::~RealWGLApi() { |
| 55 } | 56 } |
| 56 | 57 |
| 57 void RealWGLApi::Initialize(DriverWGL* driver) { | 58 void RealWGLApi::Initialize(DriverWGL* driver) { |
| 58 InitializeBase(driver); | 59 InitializeBase(driver); |
| 59 } | 60 } |
| 60 | 61 |
| 62 std::set<std::string> RealWGLApi::GetEnabledExtensions() const { |
| 63 std::set<std::string> enabled_extensions; |
| 64 |
| 65 std::vector<std::string> platform_extensions_vec; |
| 66 std::string platform_ext = DriverWGL::GetPlatformExtensions(); |
| 67 base::SplitString(platform_ext, ' ', &platform_extensions_vec); |
| 68 |
| 69 enabled_extensions.insert(platform_extensions_vec.begin(), |
| 70 platform_extensions_vec.end()); |
| 71 |
| 72 return enabled_extensions; |
| 73 } |
| 74 |
| 61 TraceWGLApi::~TraceWGLApi() { | 75 TraceWGLApi::~TraceWGLApi() { |
| 62 } | 76 } |
| 63 | 77 |
| 64 bool GetGLWindowSystemBindingInfoWGL(GLWindowSystemBindingInfo* info) { | 78 bool GetGLWindowSystemBindingInfoWGL(GLWindowSystemBindingInfo* info) { |
| 65 const char* extensions = wglGetExtensionsStringEXT(); | 79 const char* extensions = wglGetExtensionsStringEXT(); |
| 66 *info = GLWindowSystemBindingInfo(); | 80 *info = GLWindowSystemBindingInfo(); |
| 67 if (extensions) | 81 if (extensions) |
| 68 info->extensions = extensions; | 82 info->extensions = extensions; |
| 69 return true; | 83 return true; |
| 70 } | 84 } |
| 71 | 85 |
| 72 } // namespace gfx | 86 } // namespace gfx |
| 73 | 87 |
| 74 | 88 |
| OLD | NEW |