| 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 extern "C" { | 5 extern "C" { |
| 6 #include <X11/Xlib.h> | 6 #include <X11/Xlib.h> |
| 7 } | 7 } |
| 8 | 8 |
| 9 #include "ui/gl/gl_surface_glx.h" | 9 #include "ui/gl/gl_surface_glx.h" |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 class ScopedPtrXFree { | 29 class ScopedPtrXFree { |
| 30 public: | 30 public: |
| 31 void operator()(void* x) const { | 31 void operator()(void* x) const { |
| 32 ::XFree(x); | 32 ::XFree(x); |
| 33 } | 33 } |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 Display* g_display; | 36 Display* g_display; |
| 37 const char* g_glx_extensions = NULL; | 37 const char* g_glx_extensions = NULL; |
| 38 bool g_glx_create_context_robustness_supported = false; | 38 bool g_glx_create_context_robustness_supported = false; |
| 39 bool g_glx_texture_from_pixmap_supported = false; |
| 39 | 40 |
| 40 } // namespace | 41 } // namespace |
| 41 | 42 |
| 42 GLSurfaceGLX::GLSurfaceGLX() {} | 43 GLSurfaceGLX::GLSurfaceGLX() {} |
| 43 | 44 |
| 44 bool GLSurfaceGLX::InitializeOneOff() { | 45 bool GLSurfaceGLX::InitializeOneOff() { |
| 45 static bool initialized = false; | 46 static bool initialized = false; |
| 46 if (initialized) | 47 if (initialized) |
| 47 return true; | 48 return true; |
| 48 | 49 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 59 } | 60 } |
| 60 | 61 |
| 61 if (major == 1 && minor < 3) { | 62 if (major == 1 && minor < 3) { |
| 62 LOG(ERROR) << "GLX 1.3 or later is required."; | 63 LOG(ERROR) << "GLX 1.3 or later is required."; |
| 63 return false; | 64 return false; |
| 64 } | 65 } |
| 65 | 66 |
| 66 g_glx_extensions = glXQueryExtensionsString(g_display, 0); | 67 g_glx_extensions = glXQueryExtensionsString(g_display, 0); |
| 67 g_glx_create_context_robustness_supported = | 68 g_glx_create_context_robustness_supported = |
| 68 HasGLXExtension("GLX_ARB_create_context_robustness"); | 69 HasGLXExtension("GLX_ARB_create_context_robustness"); |
| 70 g_glx_texture_from_pixmap_supported = |
| 71 HasGLXExtension("GLX_EXT_texture_from_pixmap"); |
| 69 | 72 |
| 70 initialized = true; | 73 initialized = true; |
| 71 return true; | 74 return true; |
| 72 } | 75 } |
| 73 | 76 |
| 74 // static | 77 // static |
| 75 const char* GLSurfaceGLX::GetGLXExtensions() { | 78 const char* GLSurfaceGLX::GetGLXExtensions() { |
| 76 return g_glx_extensions; | 79 return g_glx_extensions; |
| 77 } | 80 } |
| 78 | 81 |
| 79 // static | 82 // static |
| 80 bool GLSurfaceGLX::HasGLXExtension(const char* name) { | 83 bool GLSurfaceGLX::HasGLXExtension(const char* name) { |
| 81 return ExtensionsContain(GetGLXExtensions(), name); | 84 return ExtensionsContain(GetGLXExtensions(), name); |
| 82 } | 85 } |
| 83 | 86 |
| 84 // static | 87 // static |
| 85 bool GLSurfaceGLX::IsCreateContextRobustnessSupported() { | 88 bool GLSurfaceGLX::IsCreateContextRobustnessSupported() { |
| 86 return g_glx_create_context_robustness_supported; | 89 return g_glx_create_context_robustness_supported; |
| 87 } | 90 } |
| 88 | 91 |
| 92 // static |
| 93 bool GLSurfaceGLX::IsTextureFromPixmapSupported() { |
| 94 return g_glx_texture_from_pixmap_supported; |
| 95 } |
| 96 |
| 89 void* GLSurfaceGLX::GetDisplay() { | 97 void* GLSurfaceGLX::GetDisplay() { |
| 90 return g_display; | 98 return g_display; |
| 91 } | 99 } |
| 92 | 100 |
| 93 GLSurfaceGLX::~GLSurfaceGLX() {} | 101 GLSurfaceGLX::~GLSurfaceGLX() {} |
| 94 | 102 |
| 95 NativeViewGLSurfaceGLX::NativeViewGLSurfaceGLX(gfx::AcceleratedWidget window) | 103 NativeViewGLSurfaceGLX::NativeViewGLSurfaceGLX(gfx::AcceleratedWidget window) |
| 96 : window_(window), | 104 : window_(window), |
| 97 config_(NULL) { | 105 config_(NULL) { |
| 98 } | 106 } |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 316 |
| 309 void* PbufferGLSurfaceGLX::GetConfig() { | 317 void* PbufferGLSurfaceGLX::GetConfig() { |
| 310 return config_; | 318 return config_; |
| 311 } | 319 } |
| 312 | 320 |
| 313 PbufferGLSurfaceGLX::~PbufferGLSurfaceGLX() { | 321 PbufferGLSurfaceGLX::~PbufferGLSurfaceGLX() { |
| 314 Destroy(); | 322 Destroy(); |
| 315 } | 323 } |
| 316 | 324 |
| 317 } // namespace gfx | 325 } // namespace gfx |
| OLD | NEW |