summaryrefslogtreecommitdiffstats
path: root/ui/gfx
diff options
context:
space:
mode:
authorbacker@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-26 14:58:05 +0000
committerbacker@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-26 14:58:05 +0000
commitcfdc97c7c9564b7427869d2ec1f5c6b550dc3f4a (patch)
treec9880e8a927212564d40253fde5fe890690fb11b /ui/gfx
parent6c5967c5f124feff63480d7c438b209c4fb8759b (diff)
downloadchromium_src-cfdc97c7c9564b7427869d2ec1f5c6b550dc3f4a.zip
chromium_src-cfdc97c7c9564b7427869d2ec1f5c6b550dc3f4a.tar.gz
chromium_src-cfdc97c7c9564b7427869d2ec1f5c6b550dc3f4a.tar.bz2
Expose NativeDisplay from GLSurfaceEGL.
In order to use the EGLImage wrapper around an X11 pixmap (separate CL), I need to create the pixmap with the NativeDisplay associated with GLSurfaceEGL. This caches and exposes the NativeDisplay. Did the same for Windows while I was at it. BUG=none TEST=trybots and by hand on Linux and Windows with 3D CSS and WebGL Review URL: http://codereview.chromium.org/7031051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86827 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx')
-rw-r--r--ui/gfx/gl/gl_surface_egl.cc11
-rw-r--r--ui/gfx/gl/gl_surface_egl.h11
2 files changed, 19 insertions, 3 deletions
diff --git a/ui/gfx/gl/gl_surface_egl.cc b/ui/gfx/gl/gl_surface_egl.cc
index 285f003..603cff4 100644
--- a/ui/gfx/gl/gl_surface_egl.cc
+++ b/ui/gfx/gl/gl_surface_egl.cc
@@ -25,6 +25,7 @@ namespace gfx {
namespace {
EGLConfig g_config;
EGLDisplay g_display;
+EGLNativeDisplayType g_native_display;
}
GLSurfaceEGL::GLSurfaceEGL() {
@@ -39,11 +40,11 @@ bool GLSurfaceEGL::InitializeOneOff() {
return true;
#if defined(USE_X11)
- EGLNativeDisplayType native_display = XOpenDisplay(NULL);
+ g_native_display = XOpenDisplay(NULL);
#else
- EGLNativeDisplayType native_display = EGL_DEFAULT_DISPLAY;
+ g_native_display = EGL_DEFAULT_DISPLAY;
#endif
- g_display = eglGetDisplay(native_display);
+ g_display = eglGetDisplay(g_native_display);
if (!g_display) {
LOG(ERROR) << "eglGetDisplay failed with error " << GetLastEGLErrorString();
return false;
@@ -109,6 +110,10 @@ EGLConfig GLSurfaceEGL::GetConfig() {
return g_config;
}
+EGLNativeDisplayType GLSurfaceEGL::GetNativeDisplay() {
+ return g_native_display;
+}
+
NativeViewGLSurfaceEGL::NativeViewGLSurfaceEGL(gfx::PluginWindowHandle window)
: window_(window),
surface_(NULL)
diff --git a/ui/gfx/gl/gl_surface_egl.h b/ui/gfx/gl/gl_surface_egl.h
index 8eef467..2bf8f82 100644
--- a/ui/gfx/gl/gl_surface_egl.h
+++ b/ui/gfx/gl/gl_surface_egl.h
@@ -6,6 +6,10 @@
#define UI_GFX_GL_GL_SURFACE_EGL_H_
#pragma once
+#if defined(OS_WIN)
+#include <windows.h>
+#endif
+
#include "ui/gfx/gl/gl_surface.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/size.h"
@@ -14,6 +18,12 @@ typedef void* EGLConfig;
typedef void* EGLDisplay;
typedef void* EGLSurface;
+#if defined(OS_WIN)
+typedef HDC EGLNativeDisplayType;
+#else
+typedef struct _XDisplay* EGLNativeDisplayType;
+#endif
+
namespace gfx {
// Interface for EGL surface.
@@ -25,6 +35,7 @@ class GLSurfaceEGL : public GLSurface {
static bool InitializeOneOff();
static EGLDisplay GetDisplay();
static EGLConfig GetConfig();
+ static EGLNativeDisplayType GetNativeDisplay();
private:
DISALLOW_COPY_AND_ASSIGN(GLSurfaceEGL);