Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || defined(USE_OZ ONE) | 5 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || defined(USE_OZ ONE) |
| 6 #include <EGL/egl.h> | 6 #include <EGL/egl.h> |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #include "ui/gl/gl_bindings.h" | 9 #include "ui/gl/gl_bindings.h" |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 GLSurfaceWGL::GetDisplayDC()); | 34 GLSurfaceWGL::GetDisplayDC()); |
| 35 } else if (g_driver_wgl.fn.wglGetExtensionsStringEXTFn) { | 35 } else if (g_driver_wgl.fn.wglGetExtensionsStringEXTFn) { |
| 36 str = g_driver_wgl.fn.wglGetExtensionsStringEXTFn(); | 36 str = g_driver_wgl.fn.wglGetExtensionsStringEXTFn(); |
| 37 } | 37 } |
| 38 return str ? std::string(str) : ""; | 38 return str ? std::string(str) : ""; |
| 39 } | 39 } |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || defined(USE_OZ ONE) | 42 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || defined(USE_OZ ONE) |
| 43 std::string DriverEGL::GetPlatformExtensions() { | 43 std::string DriverEGL::GetPlatformExtensions() { |
| 44 #if defined(OS_WIN) | |
| 45 EGLDisplay display = GLSurfaceEGL::InitializeDisplay(); | |
| 46 if (display == EGL_NO_DISPLAY) | |
| 47 return ""; | |
|
Jamie Madill
2015/04/20 18:33:11
I wasn't sure if I should put the NO_DISPLAY check
Zhenyao Mo
2015/04/20 19:51:47
If display isn't valid, eglQueryString just return
Jamie Madill
2015/04/20 20:20:09
One difference - if display is EGL_NO_DISPLAY and
| |
| 48 #else | |
| 44 EGLDisplay display = | 49 EGLDisplay display = |
| 45 #if defined(OS_WIN) | 50 g_driver_egl.fn.eglGetDisplayFn(GetPlatformDefaultEGLNativeDisplay()); |
| 46 GLSurfaceEGL::GetPlatformDisplay(GetPlatformDefaultEGLNativeDisplay()); | 51 DCHECK(g_driver_egl.fn.eglInitializeFn); |
| 47 #else | 52 g_driver_egl.fn.eglInitializeFn(display, NULL, NULL); |
| 48 g_driver_egl.fn.eglGetDisplayFn(GetPlatformDefaultEGLNativeDisplay()); | |
| 49 #endif | 53 #endif |
| 50 | 54 |
| 51 DCHECK(g_driver_egl.fn.eglInitializeFn); | |
| 52 g_driver_egl.fn.eglInitializeFn(display, NULL, NULL); | |
| 53 DCHECK(g_driver_egl.fn.eglQueryStringFn); | 55 DCHECK(g_driver_egl.fn.eglQueryStringFn); |
| 54 const char* str = g_driver_egl.fn.eglQueryStringFn(display, EGL_EXTENSIONS); | 56 const char* str = g_driver_egl.fn.eglQueryStringFn(display, EGL_EXTENSIONS); |
| 55 return str ? std::string(str) : ""; | 57 return str ? std::string(str) : ""; |
| 56 } | 58 } |
| 57 | 59 |
| 58 // static | 60 // static |
| 59 std::string DriverEGL::GetClientExtensions() { | 61 std::string DriverEGL::GetClientExtensions() { |
| 60 const char* str = | 62 const char* str = |
| 61 g_driver_egl.fn.eglQueryStringFn(EGL_NO_DISPLAY, EGL_EXTENSIONS); | 63 g_driver_egl.fn.eglQueryStringFn(EGL_NO_DISPLAY, EGL_EXTENSIONS); |
| 62 return str ? std::string(str) : ""; | 64 return str ? std::string(str) : ""; |
| 63 } | 65 } |
| 64 #endif | 66 #endif |
| 65 | 67 |
| 66 #if defined(USE_X11) | 68 #if defined(USE_X11) |
| 67 std::string DriverGLX::GetPlatformExtensions() { | 69 std::string DriverGLX::GetPlatformExtensions() { |
| 68 DCHECK(g_driver_glx.fn.glXQueryExtensionsStringFn); | 70 DCHECK(g_driver_glx.fn.glXQueryExtensionsStringFn); |
| 69 const char* str = | 71 const char* str = |
| 70 g_driver_glx.fn.glXQueryExtensionsStringFn(gfx::GetXDisplay(), 0); | 72 g_driver_glx.fn.glXQueryExtensionsStringFn(gfx::GetXDisplay(), 0); |
| 71 return str ? std::string(str) : ""; | 73 return str ? std::string(str) : ""; |
| 72 } | 74 } |
| 73 #endif | 75 #endif |
| 74 | 76 |
| 75 } // namespace gfx | 77 } // namespace gfx |
| OLD | NEW |