| 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 #include "ui/gfx/gl/gl_surface_egl.h" | 5 #include "ui/gfx/gl/gl_surface_egl.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop.h" |
| 10 #if !defined(OS_ANDROID) | 11 #if !defined(OS_ANDROID) |
| 11 #include "third_party/angle/include/EGL/egl.h" | 12 #include "third_party/angle/include/EGL/egl.h" |
| 12 #include "third_party/angle/include/EGL/eglext.h" | 13 #include "third_party/angle/include/EGL/eglext.h" |
| 13 #endif | 14 #endif |
| 14 #include "ui/gfx/gl/egl_util.h" | 15 #include "ui/gfx/gl/egl_util.h" |
| 15 | 16 |
| 16 #if defined(OS_ANDROID) | 17 #if defined(OS_ANDROID) |
| 17 #include <EGL/egl.h> | 18 #include <EGL/egl.h> |
| 18 #endif | 19 #endif |
| 19 | 20 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 49 } | 50 } |
| 50 | 51 |
| 51 bool GLSurfaceEGL::InitializeOneOff() { | 52 bool GLSurfaceEGL::InitializeOneOff() { |
| 52 static bool initialized = false; | 53 static bool initialized = false; |
| 53 if (initialized) | 54 if (initialized) |
| 54 return true; | 55 return true; |
| 55 | 56 |
| 56 #if defined(USE_WAYLAND) | 57 #if defined(USE_WAYLAND) |
| 57 g_native_display = ui::WaylandDisplay::Connect(NULL)->display(); | 58 g_native_display = ui::WaylandDisplay::Connect(NULL)->display(); |
| 58 #elif defined(USE_X11) | 59 #elif defined(USE_X11) |
| 59 g_native_display = XOpenDisplay(NULL); | 60 g_native_display = base::MessagePumpForUI::GetDefaultXDisplay(); |
| 60 #else | 61 #else |
| 61 g_native_display = EGL_DEFAULT_DISPLAY; | 62 g_native_display = EGL_DEFAULT_DISPLAY; |
| 62 #endif | 63 #endif |
| 63 g_display = eglGetDisplay(g_native_display); | 64 g_display = eglGetDisplay(g_native_display); |
| 64 if (!g_display) { | 65 if (!g_display) { |
| 65 LOG(ERROR) << "eglGetDisplay failed with error " << GetLastEGLErrorString(); | 66 LOG(ERROR) << "eglGetDisplay failed with error " << GetLastEGLErrorString(); |
| 66 return false; | 67 return false; |
| 67 } | 68 } |
| 68 | 69 |
| 69 if (!eglInitialize(g_display, NULL, NULL)) { | 70 if (!eglInitialize(g_display, NULL, NULL)) { |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE, | 382 EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE, |
| 382 &handle)) { | 383 &handle)) { |
| 383 return NULL; | 384 return NULL; |
| 384 } | 385 } |
| 385 | 386 |
| 386 return handle; | 387 return handle; |
| 387 #endif | 388 #endif |
| 388 } | 389 } |
| 389 | 390 |
| 390 } // namespace gfx | 391 } // namespace gfx |
| OLD | NEW |