OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <EGL/egl.h> | 5 #include <EGL/egl.h> |
6 | 6 |
7 #include "build/build_config.h" | |
8 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
9 #include "app/x11_util.h" | 8 extern "C" { |
| 9 #include <X11/Xlib.h> |
| 10 } |
10 #define EGL_HAS_PBUFFERS 1 | 11 #define EGL_HAS_PBUFFERS 1 |
11 #endif | 12 #endif |
| 13 |
| 14 #include "build/build_config.h" |
12 #include "base/logging.h" | 15 #include "base/logging.h" |
13 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
14 #include "app/gfx/gl/gl_bindings.h" | 17 #include "app/gfx/gl/gl_bindings.h" |
15 #include "app/gfx/gl/gl_context_egl.h" | 18 #include "app/gfx/gl/gl_context_egl.h" |
16 | 19 |
17 namespace gfx { | 20 namespace gfx { |
18 | 21 |
19 namespace { | 22 namespace { |
20 | 23 |
21 // The EGL configuration to use. | 24 // The EGL configuration to use. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 EGLSurface SharedEGLSurface::egl_surface() const { | 76 EGLSurface SharedEGLSurface::egl_surface() const { |
74 return surface_; | 77 return surface_; |
75 } | 78 } |
76 | 79 |
77 bool BaseEGLContext::InitializeOneOff() { | 80 bool BaseEGLContext::InitializeOneOff() { |
78 static bool initialized = false; | 81 static bool initialized = false; |
79 if (initialized) | 82 if (initialized) |
80 return true; | 83 return true; |
81 | 84 |
82 #ifdef OS_LINUX | 85 #ifdef OS_LINUX |
83 EGLNativeDisplayType native_display = x11_util::GetXDisplay(); | 86 EGLNativeDisplayType native_display = XOpenDisplay(NULL); |
84 #else | 87 #else |
85 EGLNativeDisplayType native_display = EGL_DEFAULT_DISPLAY; | 88 EGLNativeDisplayType native_display = EGL_DEFAULT_DISPLAY; |
86 #endif | 89 #endif |
87 g_display = eglGetDisplay(native_display); | 90 g_display = eglGetDisplay(native_display); |
88 if (!g_display) { | 91 if (!g_display) { |
89 LOG(ERROR) << "eglGetDisplay failed with error " << GetLastEGLErrorString(); | 92 LOG(ERROR) << "eglGetDisplay failed with error " << GetLastEGLErrorString(); |
90 return false; | 93 return false; |
91 } | 94 } |
92 | 95 |
93 if (!eglInitialize(g_display, NULL, NULL)) { | 96 if (!eglInitialize(g_display, NULL, NULL)) { |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 void SecondaryEGLContext::SetSwapInterval(int interval) { | 416 void SecondaryEGLContext::SetSwapInterval(int interval) { |
414 DCHECK(IsCurrent()); | 417 DCHECK(IsCurrent()); |
415 NOTREACHED() << "Attempt to call SetSwapInterval on a SecondaryEGLContext."; | 418 NOTREACHED() << "Attempt to call SetSwapInterval on a SecondaryEGLContext."; |
416 } | 419 } |
417 | 420 |
418 SharedEGLSurface* SecondaryEGLContext::GetSurface() { | 421 SharedEGLSurface* SecondaryEGLContext::GetSurface() { |
419 return surface_; | 422 return surface_; |
420 } | 423 } |
421 | 424 |
422 } // namespace gfx | 425 } // namespace gfx |
OLD | NEW |