| 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_implementation.h" | 5 #include "ui/gl/gl_implementation.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "ui/gl/gl_bindings.h" | 13 #include "ui/gl/gl_bindings.h" |
| 14 #include "ui/gl/gl_gl_api_implementation.h" | 14 #include "ui/gl/gl_gl_api_implementation.h" |
| 15 | 15 |
| 16 #if defined(USE_OZONE) |
| 17 #include "ui/gfx/ozone/surface_factory_ozone.h" |
| 18 #endif |
| 19 |
| 16 namespace gfx { | 20 namespace gfx { |
| 17 | 21 |
| 18 namespace { | 22 namespace { |
| 19 | 23 |
| 20 const struct { | 24 const struct { |
| 21 const char* name; | 25 const char* name; |
| 22 GLImplementation implementation; | 26 GLImplementation implementation; |
| 23 } kGLImplementationNamePairs[] = { | 27 } kGLImplementationNamePairs[] = { |
| 24 { kGLImplementationDesktopName, kGLImplementationDesktopGL }, | 28 { kGLImplementationDesktopName, kGLImplementationDesktopGL }, |
| 25 { kGLImplementationOSMesaName, kGLImplementationOSMesaGL }, | 29 { kGLImplementationOSMesaName, kGLImplementationOSMesaGL }, |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 void SetGLGetProcAddressProc(GLGetProcAddressProc proc) { | 125 void SetGLGetProcAddressProc(GLGetProcAddressProc proc) { |
| 122 DCHECK(proc); | 126 DCHECK(proc); |
| 123 g_get_proc_address = proc; | 127 g_get_proc_address = proc; |
| 124 } | 128 } |
| 125 | 129 |
| 126 void* GetGLProcAddress(const char* name) { | 130 void* GetGLProcAddress(const char* name) { |
| 127 DCHECK(g_gl_implementation != kGLImplementationNone); | 131 DCHECK(g_gl_implementation != kGLImplementationNone); |
| 128 | 132 |
| 129 if (g_libraries) { | 133 if (g_libraries) { |
| 130 for (size_t i = 0; i < g_libraries->size(); ++i) { | 134 for (size_t i = 0; i < g_libraries->size(); ++i) { |
| 135 #if defined(USE_OZONE) |
| 136 void* proc = gfx::SurfaceFactoryOzone::GetInstance()-> |
| 137 GetFunctionPointerFromNativeLibrary((*g_libraries)[i], name); |
| 138 #else |
| 131 void* proc = base::GetFunctionPointerFromNativeLibrary((*g_libraries)[i], | 139 void* proc = base::GetFunctionPointerFromNativeLibrary((*g_libraries)[i], |
| 132 name); | 140 name); |
| 141 #endif |
| 133 if (proc) | 142 if (proc) |
| 134 return proc; | 143 return proc; |
| 135 } | 144 } |
| 136 } | 145 } |
| 137 if (g_get_proc_address) { | 146 if (g_get_proc_address) { |
| 138 void* proc = g_get_proc_address(name); | 147 void* proc = g_get_proc_address(name); |
| 139 if (proc) | 148 if (proc) |
| 140 return proc; | 149 return proc; |
| 141 } | 150 } |
| 142 | 151 |
| 143 return NULL; | 152 return NULL; |
| 144 } | 153 } |
| 145 | 154 |
| 146 void InitializeNullDrawGLBindings() { | 155 void InitializeNullDrawGLBindings() { |
| 147 // This is platform independent, so it does not need to live in a platform | 156 // This is platform independent, so it does not need to live in a platform |
| 148 // specific implementation file. | 157 // specific implementation file. |
| 149 InitializeNullDrawGLBindingsGL(); | 158 InitializeNullDrawGLBindingsGL(); |
| 150 } | 159 } |
| 151 | 160 |
| 152 } // namespace gfx | 161 } // namespace gfx |
| OLD | NEW |