OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 extern "C" { | 5 extern "C" { |
6 #include <X11/Xlib.h> | 6 #include <X11/Xlib.h> |
7 } | 7 } |
8 | 8 |
9 #include "ui/gfx/gl/gl_surface_glx.h" | 9 #include "ui/gfx/gl/gl_surface_glx.h" |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 66 } |
67 | 67 |
68 g_glx_extensions = glXQueryExtensionsString(g_display, 0); | 68 g_glx_extensions = glXQueryExtensionsString(g_display, 0); |
69 g_glx_create_context_robustness_supported = | 69 g_glx_create_context_robustness_supported = |
70 HasGLXExtension("GLX_ARB_create_context_robustness"); | 70 HasGLXExtension("GLX_ARB_create_context_robustness"); |
71 | 71 |
72 initialized = true; | 72 initialized = true; |
73 return true; | 73 return true; |
74 } | 74 } |
75 | 75 |
76 Display* GLSurfaceGLX::GetDisplay() { | |
77 return g_display; | |
78 } | |
79 | |
80 const char* GLSurfaceGLX::GetGLXExtensions() { | 76 const char* GLSurfaceGLX::GetGLXExtensions() { |
81 return g_glx_extensions; | 77 return g_glx_extensions; |
82 } | 78 } |
83 | 79 |
84 bool GLSurfaceGLX::HasGLXExtension(const char* name) { | 80 bool GLSurfaceGLX::HasGLXExtension(const char* name) { |
85 DCHECK(name); | 81 DCHECK(name); |
86 const char* c_extensions = GetGLXExtensions(); | 82 const char* c_extensions = GetGLXExtensions(); |
87 if (!c_extensions) | 83 if (!c_extensions) |
88 return false; | 84 return false; |
89 std::string extensions(c_extensions); | 85 std::string extensions(c_extensions); |
90 extensions += " "; | 86 extensions += " "; |
91 | 87 |
92 std::string delimited_name(name); | 88 std::string delimited_name(name); |
93 delimited_name += " "; | 89 delimited_name += " "; |
94 | 90 |
95 return extensions.find(delimited_name) != std::string::npos; | 91 return extensions.find(delimited_name) != std::string::npos; |
96 } | 92 } |
97 | 93 |
98 bool GLSurfaceGLX::IsCreateContextRobustnessSupported() { | 94 bool GLSurfaceGLX::IsCreateContextRobustnessSupported() { |
99 return g_glx_create_context_robustness_supported; | 95 return g_glx_create_context_robustness_supported; |
100 } | 96 } |
101 | 97 |
| 98 void* GLSurfaceGLX::GetDisplay() { |
| 99 return g_display; |
| 100 } |
| 101 |
102 NativeViewGLSurfaceGLX::NativeViewGLSurfaceGLX(gfx::PluginWindowHandle window) | 102 NativeViewGLSurfaceGLX::NativeViewGLSurfaceGLX(gfx::PluginWindowHandle window) |
103 : window_(window), | 103 : window_(window), |
104 config_(NULL) { | 104 config_(NULL) { |
105 } | 105 } |
106 | 106 |
107 NativeViewGLSurfaceGLX::NativeViewGLSurfaceGLX() | 107 NativeViewGLSurfaceGLX::NativeViewGLSurfaceGLX() |
108 : window_(0), | 108 : window_(0), |
109 config_(NULL) { | 109 config_(NULL) { |
110 } | 110 } |
111 | 111 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 286 |
287 void* PbufferGLSurfaceGLX::GetHandle() { | 287 void* PbufferGLSurfaceGLX::GetHandle() { |
288 return reinterpret_cast<void*>(pbuffer_); | 288 return reinterpret_cast<void*>(pbuffer_); |
289 } | 289 } |
290 | 290 |
291 void* PbufferGLSurfaceGLX::GetConfig() { | 291 void* PbufferGLSurfaceGLX::GetConfig() { |
292 return config_; | 292 return config_; |
293 } | 293 } |
294 | 294 |
295 } // namespace gfx | 295 } // namespace gfx |
OLD | NEW |