| 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 <vector> |
| 6 |
| 7 #include "base/strings/string_split.h" |
| 5 #include "ui/gl/gl_osmesa_api_implementation.h" | 8 #include "ui/gl/gl_osmesa_api_implementation.h" |
| 6 | 9 |
| 7 namespace gfx { | 10 namespace gfx { |
| 8 | 11 |
| 9 RealOSMESAApi* g_real_osmesa; | 12 RealOSMESAApi* g_real_osmesa; |
| 10 | 13 |
| 11 void InitializeStaticGLBindingsOSMESA() { | 14 void InitializeStaticGLBindingsOSMESA() { |
| 12 g_driver_osmesa.InitializeStaticBindings(); | 15 g_driver_osmesa.InitializeStaticBindings(); |
| 13 if (!g_real_osmesa) { | 16 if (!g_real_osmesa) { |
| 14 g_real_osmesa = new RealOSMESAApi(); | 17 g_real_osmesa = new RealOSMESAApi(); |
| 15 } | 18 } |
| 16 g_real_osmesa->Initialize(&g_driver_osmesa); | 19 g_real_osmesa->Initialize(&g_driver_osmesa); |
| 20 g_driver_osmesa.InitializeExtensionBindings( |
| 21 g_real_osmesa->GetEnabledExtensions()); |
| 17 g_current_osmesa_context = g_real_osmesa; | 22 g_current_osmesa_context = g_real_osmesa; |
| 18 } | 23 } |
| 19 | 24 |
| 20 void InitializeDebugGLBindingsOSMESA() { | 25 void InitializeDebugGLBindingsOSMESA() { |
| 21 g_driver_osmesa.InitializeDebugBindings(); | 26 g_driver_osmesa.InitializeDebugBindings(); |
| 22 } | 27 } |
| 23 | 28 |
| 24 void ClearGLBindingsOSMESA() { | 29 void ClearGLBindingsOSMESA() { |
| 25 if (g_real_osmesa) { | 30 if (g_real_osmesa) { |
| 26 delete g_real_osmesa; | 31 delete g_real_osmesa; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 50 RealOSMESAApi::RealOSMESAApi() { | 55 RealOSMESAApi::RealOSMESAApi() { |
| 51 } | 56 } |
| 52 | 57 |
| 53 RealOSMESAApi::~RealOSMESAApi() { | 58 RealOSMESAApi::~RealOSMESAApi() { |
| 54 } | 59 } |
| 55 | 60 |
| 56 void RealOSMESAApi::Initialize(DriverOSMESA* driver) { | 61 void RealOSMESAApi::Initialize(DriverOSMESA* driver) { |
| 57 InitializeBase(driver); | 62 InitializeBase(driver); |
| 58 } | 63 } |
| 59 | 64 |
| 65 std::set<std::string> RealOSMESAApi::GetEnabledExtensions() const { |
| 66 std::set<std::string> enabled_extensions; |
| 67 |
| 68 std::vector<std::string> platform_extensions_vec; |
| 69 std::string platform_ext = DriverOSMESA::GetPlatformExtensions(); |
| 70 base::SplitString(platform_ext, ' ', &platform_extensions_vec); |
| 71 |
| 72 enabled_extensions.insert(platform_extensions_vec.begin(), |
| 73 platform_extensions_vec.end()); |
| 74 |
| 75 return enabled_extensions; |
| 76 } |
| 77 |
| 60 TraceOSMESAApi::~TraceOSMESAApi() { | 78 TraceOSMESAApi::~TraceOSMESAApi() { |
| 61 } | 79 } |
| 62 | 80 |
| 63 } // namespace gfx | 81 } // namespace gfx |
| 64 | 82 |
| 65 | 83 |
| OLD | NEW |