summaryrefslogtreecommitdiffstats
path: root/ui/gfx/gl
diff options
context:
space:
mode:
Diffstat (limited to 'ui/gfx/gl')
-rw-r--r--ui/gfx/gl/generate_bindings.py2
-rw-r--r--ui/gfx/gl/gl_context_egl.cc7
-rw-r--r--ui/gfx/gl/gl_context_glx.cc45
-rw-r--r--ui/gfx/gl/gl_context_glx.h2
-rw-r--r--ui/gfx/gl/gl_context_osmesa.cc6
-rw-r--r--ui/gfx/gl/gl_context_wgl.cc7
-rw-r--r--ui/gfx/gl/gl_surface.cc84
-rw-r--r--ui/gfx/gl/gl_surface.h46
-rw-r--r--ui/gfx/gl/gl_surface_egl.cc25
-rw-r--r--ui/gfx/gl/gl_surface_egl.h8
-rw-r--r--ui/gfx/gl/gl_surface_glx.cc8
-rw-r--r--ui/gfx/gl/gl_surface_glx.h3
-rw-r--r--ui/gfx/gl/gl_surface_osmesa.cc5
-rw-r--r--ui/gfx/gl/gl_surface_osmesa.h6
-rw-r--r--ui/gfx/gl/gl_surface_wgl.cc6
-rw-r--r--ui/gfx/gl/gl_surface_wgl.h5
16 files changed, 217 insertions, 48 deletions
diff --git a/ui/gfx/gl/generate_bindings.py b/ui/gfx/gl/generate_bindings.py
index b3f52fb..9d5ecf8 100644
--- a/ui/gfx/gl/generate_bindings.py
+++ b/ui/gfx/gl/generate_bindings.py
@@ -362,6 +362,8 @@ EGL_FUNCTIONS = [
'EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target'],
['__eglMustCastToProperFunctionPointerType', ['eglGetProcAddress'],
'const char* procname'],
+['EGLBoolean', ['eglQuerySurfacePointerANGLE'],
+ 'EGLDisplay dpy, EGLSurface surface, EGLint attribute, void** value'],
]
WGL_FUNCTIONS = [
diff --git a/ui/gfx/gl/gl_context_egl.cc b/ui/gfx/gl/gl_context_egl.cc
index ffaaaea..6c69f79 100644
--- a/ui/gfx/gl/gl_context_egl.cc
+++ b/ui/gfx/gl/gl_context_egl.cc
@@ -8,8 +8,8 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "third_party/angle/include/EGL/egl.h"
-#include "ui/gfx/gl/gl_surface_egl.h"
#include "ui/gfx/gl/egl_util.h"
+#include "ui/gfx/gl/gl_surface.h"
// This header must come after the above third-party include, as
// it brings in #defines that cause conflicts.
@@ -52,9 +52,8 @@ bool GLContextEGL::Initialize(
EGL_NONE
};
- GLSurfaceEGL* egl_surface = static_cast<GLSurfaceEGL*>(compatible_surface);
- display_ = egl_surface->GetDisplay();
- config_ = egl_surface->GetConfig();
+ display_ = compatible_surface->GetDisplay();
+ config_ = compatible_surface->GetConfig();
context_ = eglCreateContext(
display_,
diff --git a/ui/gfx/gl/gl_context_glx.cc b/ui/gfx/gl/gl_context_glx.cc
index 0797721..0f392e6 100644
--- a/ui/gfx/gl/gl_context_glx.cc
+++ b/ui/gfx/gl/gl_context_glx.cc
@@ -46,7 +46,8 @@ bool IsCompositingWindowManagerActive(Display* display) {
GLContextGLX::GLContextGLX(GLShareGroup* share_group)
: GLContext(share_group),
- context_(NULL) {
+ context_(NULL),
+ display_(NULL) {
}
GLContextGLX::~GLContextGLX() {
@@ -55,7 +56,7 @@ GLContextGLX::~GLContextGLX() {
bool GLContextGLX::Initialize(
GLSurface* compatible_surface, GpuPreference gpu_preference) {
- GLSurfaceGLX* surface_glx = static_cast<GLSurfaceGLX*>(compatible_surface);
+ display_ = static_cast<Display*>(compatible_surface->GetDisplay());
GLXContext share_handle = static_cast<GLXContext>(
share_group() ? share_group()->GetHandle() : NULL);
@@ -68,14 +69,15 @@ bool GLContextGLX::Initialize(
attribs.push_back(GLX_LOSE_CONTEXT_ON_RESET_ARB);
attribs.push_back(0);
context_ = glXCreateContextAttribsARB(
- GLSurfaceGLX::GetDisplay(),
- static_cast<GLXFBConfig>(surface_glx->GetConfig()),
+ display_,
+ static_cast<GLXFBConfig>(compatible_surface->GetConfig()),
share_handle,
True,
&attribs.front());
if (context_) {
DLOG(INFO) << " Successfully allocated "
- << (surface_glx->IsOffscreen() ? "offscreen" : "onscreen")
+ << (compatible_surface->IsOffscreen() ?
+ "offscreen" : "onscreen")
<< " GL context with LOSE_CONTEXT_ON_RESET_ARB";
} else {
// TODO(kbr): it is not expected that things will work properly
@@ -93,24 +95,23 @@ bool GLContextGLX::Initialize(
// The means by which the context is created depends on whether
// the drawable type works reliably with GLX 1.3. If it does not
// then fall back to GLX 1.2.
- if (surface_glx->IsOffscreen()) {
+ if (compatible_surface->IsOffscreen()) {
context_ = glXCreateNewContext(
- GLSurfaceGLX::GetDisplay(),
- static_cast<GLXFBConfig>(surface_glx->GetConfig()),
+ display_,
+ static_cast<GLXFBConfig>(compatible_surface->GetConfig()),
GLX_RGBA_TYPE,
share_handle,
True);
} else {
- Display* display = GLSurfaceGLX::GetDisplay();
-
// Get the visuals for the X drawable.
XWindowAttributes attributes;
if (!XGetWindowAttributes(
- display,
- reinterpret_cast<GLXDrawable>(surface_glx->GetHandle()),
+ display_,
+ reinterpret_cast<GLXDrawable>(compatible_surface->GetHandle()),
&attributes)) {
LOG(ERROR) << "XGetWindowAttributes failed for window " <<
- reinterpret_cast<GLXDrawable>(surface_glx->GetHandle()) << ".";
+ reinterpret_cast<GLXDrawable>(
+ compatible_surface->GetHandle()) << ".";
return false;
}
@@ -119,7 +120,7 @@ bool GLContextGLX::Initialize(
int visual_info_count = 0;
scoped_ptr_malloc<XVisualInfo, ScopedPtrXFree> visual_info_list(
- XGetVisualInfo(display, VisualIDMask,
+ XGetVisualInfo(display_, VisualIDMask,
&visual_info_template,
&visual_info_count));
@@ -131,7 +132,7 @@ bool GLContextGLX::Initialize(
// Attempt to create a context with each visual in turn until one works.
context_ = glXCreateContext(
- display,
+ display_,
visual_info_list.get(),
share_handle,
True);
@@ -144,9 +145,9 @@ bool GLContextGLX::Initialize(
return false;
}
- DLOG(INFO) << (surface_glx->IsOffscreen() ? "Offscreen" : "Onscreen")
+ DLOG(INFO) << (compatible_surface->IsOffscreen() ? "Offscreen" : "Onscreen")
<< " context was "
- << (glXIsDirect(GLSurfaceGLX::GetDisplay(),
+ << (glXIsDirect(display_,
static_cast<GLXContext>(context_))
? "direct" : "indirect")
<< ".";
@@ -156,7 +157,7 @@ bool GLContextGLX::Initialize(
void GLContextGLX::Destroy() {
if (context_) {
- glXDestroyContext(GLSurfaceGLX::GetDisplay(),
+ glXDestroyContext(display_,
static_cast<GLXContext>(context_));
context_ = NULL;
}
@@ -168,7 +169,7 @@ bool GLContextGLX::MakeCurrent(GLSurface* surface) {
return true;
if (!glXMakeCurrent(
- GLSurfaceGLX::GetDisplay(),
+ display_,
reinterpret_cast<GLXDrawable>(surface->GetHandle()),
static_cast<GLXContext>(context_))) {
LOG(ERROR) << "Couldn't make context current with X drawable.";
@@ -190,7 +191,7 @@ void GLContextGLX::ReleaseCurrent(GLSurface* surface) {
return;
SetCurrent(NULL, NULL);
- glXMakeContextCurrent(GLSurfaceGLX::GetDisplay(), 0, 0, NULL);
+ glXMakeContextCurrent(display_, 0, 0, NULL);
}
bool GLContextGLX::IsCurrent(GLSurface* surface) {
@@ -227,13 +228,13 @@ void GLContextGLX::SetSwapInterval(int interval) {
// respect this setting anyway (tearing still occurs) and it
// dramatically increases latency.
if (interval == 1 &&
- IsCompositingWindowManagerActive(GLSurfaceGLX::GetDisplay())) {
+ IsCompositingWindowManagerActive(display_)) {
LOG(INFO) <<
"Forcing vsync off because compositing window manager was detected.";
interval = 0;
}
glXSwapIntervalEXT(
- GLSurfaceGLX::GetDisplay(),
+ display_,
glXGetCurrentDrawable(),
interval);
} else {
diff --git a/ui/gfx/gl/gl_context_glx.h b/ui/gfx/gl/gl_context_glx.h
index 3f8a535..f5cfa14 100644
--- a/ui/gfx/gl/gl_context_glx.h
+++ b/ui/gfx/gl/gl_context_glx.h
@@ -4,6 +4,7 @@
#include <string>
+#include "ui/base/x/x11_util.h"
#include "ui/gfx/gl/gl_context.h"
namespace gfx {
@@ -30,6 +31,7 @@ class GLContextGLX : public GLContext {
private:
void* context_;
+ Display* display_;
DISALLOW_COPY_AND_ASSIGN(GLContextGLX);
};
diff --git a/ui/gfx/gl/gl_context_osmesa.cc b/ui/gfx/gl/gl_context_osmesa.cc
index 3af14ae..df7766d 100644
--- a/ui/gfx/gl/gl_context_osmesa.cc
+++ b/ui/gfx/gl/gl_context_osmesa.cc
@@ -8,7 +8,8 @@
#include "base/logging.h"
#include "ui/gfx/gl/gl_bindings.h"
-#include "ui/gfx/gl/gl_surface_osmesa.h"
+#include "ui/gfx/gl/gl_surface.h"
+#include "ui/gfx/size.h"
namespace gfx {
@@ -28,8 +29,7 @@ bool GLContextOSMesa::Initialize(
OSMesaContext share_handle = static_cast<OSMesaContext>(
share_group() ? share_group()->GetHandle() : NULL);
- GLuint format =
- static_cast<GLSurfaceOSMesa*>(compatible_surface)->GetFormat();
+ GLuint format = compatible_surface->GetFormat();
DCHECK_NE(format, (unsigned)0);
context_ = OSMesaCreateContextExt(format,
0, // depth bits
diff --git a/ui/gfx/gl/gl_context_wgl.cc b/ui/gfx/gl/gl_context_wgl.cc
index dc75b78..01506c0 100644
--- a/ui/gfx/gl/gl_context_wgl.cc
+++ b/ui/gfx/gl/gl_context_wgl.cc
@@ -28,7 +28,7 @@ std::string GLContextWGL::GetExtensions() {
// able to use surface_ here. Either use a display device context or the
// surface that was passed to MakeCurrent.
const char* extensions = wglGetExtensionsStringARB(
- GLSurfaceWGL::GetDisplay());
+ GLSurfaceWGL::GetDisplayDC());
if (extensions) {
return GLContext::GetExtensions() + " " + extensions;
}
@@ -39,13 +39,12 @@ std::string GLContextWGL::GetExtensions() {
bool GLContextWGL::Initialize(
GLSurface* compatible_surface, GpuPreference gpu_preference) {
- GLSurfaceWGL* surface_wgl = static_cast<GLSurfaceWGL*>(compatible_surface);
-
// TODO(apatrick): When contexts and surfaces are separated, we won't be
// able to use surface_ here. Either use a display device context or a
// surface that the context is compatible with not necessarily limited to
// rendering to.
- context_ = wglCreateContext(static_cast<HDC>(surface_wgl->GetHandle()));
+ context_ = wglCreateContext(
+ static_cast<HDC>(compatible_surface->GetHandle()));
if (!context_) {
LOG(ERROR) << "Failed to create GL context.";
Destroy();
diff --git a/ui/gfx/gl/gl_surface.cc b/ui/gfx/gl/gl_surface.cc
index 868b1b29..ed849c2 100644
--- a/ui/gfx/gl/gl_surface.cc
+++ b/ui/gfx/gl/gl_surface.cc
@@ -4,6 +4,7 @@
#include "ui/gfx/gl/gl_surface.h"
+#include "base/logging.h"
#include "base/threading/thread_local.h"
#include "ui/gfx/gl/gl_context.h"
@@ -24,6 +25,11 @@ bool GLSurface::Initialize()
return true;
}
+bool GLSurface::Resize(const gfx::Size& size) {
+ NOTIMPLEMENTED();
+ return false;
+}
+
unsigned int GLSurface::GetBackingFrameBufferObject() {
return 0;
}
@@ -35,6 +41,26 @@ bool GLSurface::OnMakeCurrent(GLContext* context) {
void GLSurface::SetVisible(bool visible) {
}
+void* GLSurface::GetShareHandle() {
+ NOTIMPLEMENTED();
+ return NULL;
+}
+
+void* GLSurface::GetDisplay() {
+ NOTIMPLEMENTED();
+ return NULL;
+}
+
+void* GLSurface::GetConfig() {
+ NOTIMPLEMENTED();
+ return NULL;
+}
+
+unsigned GLSurface::GetFormat() {
+ NOTIMPLEMENTED();
+ return 0;
+}
+
GLSurface* GLSurface::GetCurrent() {
return current_surface_.Get();
}
@@ -43,4 +69,62 @@ void GLSurface::SetCurrent(GLSurface* surface) {
current_surface_.Set(surface);
}
+GLSurfaceAdapter::GLSurfaceAdapter(GLSurface* surface) : surface_(surface) {
+}
+
+GLSurfaceAdapter::~GLSurfaceAdapter() {
+}
+
+bool GLSurfaceAdapter::Initialize() {
+ return surface_->Initialize();
+}
+
+void GLSurfaceAdapter::Destroy() {
+ surface_->Destroy();
+}
+
+bool GLSurfaceAdapter::Resize(const gfx::Size& size) {
+ return surface_->Resize(size);
+}
+
+bool GLSurfaceAdapter::IsOffscreen() {
+ return surface_->IsOffscreen();
+}
+
+bool GLSurfaceAdapter::SwapBuffers() {
+ return surface_->SwapBuffers();
+}
+
+gfx::Size GLSurfaceAdapter::GetSize() {
+ return surface_->GetSize();
+}
+
+void* GLSurfaceAdapter::GetHandle() {
+ return surface_->GetHandle();
+}
+
+unsigned int GLSurfaceAdapter::GetBackingFrameBufferObject() {
+ return surface_->GetBackingFrameBufferObject();
+}
+
+bool GLSurfaceAdapter::OnMakeCurrent(GLContext* context) {
+ return surface_->OnMakeCurrent(context);
+}
+
+void* GLSurfaceAdapter::GetShareHandle() {
+ return surface_->GetShareHandle();
+}
+
+void* GLSurfaceAdapter::GetDisplay() {
+ return surface_->GetDisplay();
+}
+
+void* GLSurfaceAdapter::GetConfig() {
+ return surface_->GetConfig();
+}
+
+unsigned GLSurfaceAdapter::GetFormat() {
+ return surface_->GetFormat();
+}
+
} // namespace gfx
diff --git a/ui/gfx/gl/gl_surface.h b/ui/gfx/gl/gl_surface.h
index 60e32c4..6cc3e22 100644
--- a/ui/gfx/gl/gl_surface.h
+++ b/ui/gfx/gl/gl_surface.h
@@ -31,6 +31,8 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> {
// Destroys the surface.
virtual void Destroy() = 0;
+ virtual bool Resize(const gfx::Size& size);
+
// Returns true if this surface is offscreen.
virtual bool IsOffscreen() = 0;
@@ -54,8 +56,24 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> {
// on error.
virtual bool OnMakeCurrent(GLContext* context);
+ // This gives a hint as to whether this surface is visible. If it is not
+ // visible, the backing store need not be preserved.
virtual void SetVisible(bool visible);
+ // Get a handle used to share the surface with another process. Returns null
+ // if this is not possible.
+ virtual void* GetShareHandle();
+
+ // Get the platform specific display on which this surface resides, if
+ // available.
+ virtual void* GetDisplay();
+
+ // Get the platfrom specific configuration for this surface, if available.
+ virtual void* GetConfig();
+
+ // Get the GL pixel format of the surface, if available.
+ virtual unsigned GetFormat();
+
// Create a GL surface that renders directly to a view.
static scoped_refptr<GLSurface> CreateViewGLSurface(
bool software,
@@ -78,6 +96,34 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> {
DISALLOW_COPY_AND_ASSIGN(GLSurface);
};
+// Implementation of GLSurface that forwards all calls through to another
+// GLSurface.
+class GL_EXPORT GLSurfaceAdapter : public GLSurface {
+ public:
+ explicit GLSurfaceAdapter(GLSurface* surface);
+ virtual ~GLSurfaceAdapter();
+
+ virtual bool Initialize();
+ virtual void Destroy();
+ virtual bool Resize(const gfx::Size& size);
+ virtual bool IsOffscreen();
+ virtual bool SwapBuffers();
+ virtual gfx::Size GetSize();
+ virtual void* GetHandle();
+ virtual unsigned int GetBackingFrameBufferObject();
+ virtual bool OnMakeCurrent(GLContext* context);
+ virtual void* GetShareHandle();
+ virtual void* GetDisplay();
+ virtual void* GetConfig();
+ virtual unsigned GetFormat();
+
+ GLSurface* surface() const { return surface_.get(); }
+
+ private:
+ scoped_refptr<GLSurface> surface_;
+ DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter);
+};
+
} // namespace gfx
#endif // UI_GFX_GL_GL_SURFACE_H_
diff --git a/ui/gfx/gl/gl_surface_egl.cc b/ui/gfx/gl/gl_surface_egl.cc
index a69466d..6f6d630 100644
--- a/ui/gfx/gl/gl_surface_egl.cc
+++ b/ui/gfx/gl/gl_surface_egl.cc
@@ -307,8 +307,33 @@ gfx::Size PbufferGLSurfaceEGL::GetSize() {
return size_;
}
+bool PbufferGLSurfaceEGL::Resize(const gfx::Size& size) {
+ if (size == size_)
+ return true;
+
+ Destroy();
+ size_ = size;
+ return Initialize();
+}
+
EGLSurface PbufferGLSurfaceEGL::GetHandle() {
return surface_;
}
+void* PbufferGLSurfaceEGL::GetShareHandle() {
+ const char* extensions = eglQueryString(g_display, EGL_EXTENSIONS);
+ if (!strstr(extensions, "EGL_ANGLE_query_surface_pointer"))
+ return NULL;
+
+ void* handle;
+ if (!eglQuerySurfacePointerANGLE(g_display,
+ GetHandle(),
+ EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE,
+ &handle)) {
+ return NULL;
+ }
+
+ return handle;
+}
+
} // namespace gfx
diff --git a/ui/gfx/gl/gl_surface_egl.h b/ui/gfx/gl/gl_surface_egl.h
index 8cb5caf..de68fc8 100644
--- a/ui/gfx/gl/gl_surface_egl.h
+++ b/ui/gfx/gl/gl_surface_egl.h
@@ -34,9 +34,11 @@ class GL_EXPORT GLSurfaceEGL : public GLSurface {
GLSurfaceEGL();
virtual ~GLSurfaceEGL();
+ // Implement GLSurface.
+ virtual EGLDisplay GetDisplay();
+ virtual EGLConfig GetConfig();
+
static bool InitializeOneOff();
- EGLDisplay GetDisplay();
- EGLConfig GetConfig();
static EGLDisplay GetHardwareDisplay();
static EGLDisplay GetSoftwareDisplay();
static EGLNativeDisplayType GetNativeDisplay();
@@ -81,7 +83,9 @@ class GL_EXPORT PbufferGLSurfaceEGL : public GLSurfaceEGL {
virtual bool IsOffscreen();
virtual bool SwapBuffers();
virtual gfx::Size GetSize();
+ virtual bool Resize(const gfx::Size& size);
virtual EGLSurface GetHandle();
+ virtual void* GetShareHandle();
private:
gfx::Size size_;
diff --git a/ui/gfx/gl/gl_surface_glx.cc b/ui/gfx/gl/gl_surface_glx.cc
index d380f8f..2f2380f 100644
--- a/ui/gfx/gl/gl_surface_glx.cc
+++ b/ui/gfx/gl/gl_surface_glx.cc
@@ -73,10 +73,6 @@ bool GLSurfaceGLX::InitializeOneOff() {
return true;
}
-Display* GLSurfaceGLX::GetDisplay() {
- return g_display;
-}
-
const char* GLSurfaceGLX::GetGLXExtensions() {
return g_glx_extensions;
}
@@ -99,6 +95,10 @@ bool GLSurfaceGLX::IsCreateContextRobustnessSupported() {
return g_glx_create_context_robustness_supported;
}
+void* GLSurfaceGLX::GetDisplay() {
+ return g_display;
+}
+
NativeViewGLSurfaceGLX::NativeViewGLSurfaceGLX(gfx::PluginWindowHandle window)
: window_(window),
config_(NULL) {
diff --git a/ui/gfx/gl/gl_surface_glx.h b/ui/gfx/gl/gl_surface_glx.h
index dda14b4..7784a79 100644
--- a/ui/gfx/gl/gl_surface_glx.h
+++ b/ui/gfx/gl/gl_surface_glx.h
@@ -21,7 +21,6 @@ class GL_EXPORT GLSurfaceGLX : public GLSurface {
virtual ~GLSurfaceGLX();
static bool InitializeOneOff();
- static Display* GetDisplay();
// These aren't particularly tied to surfaces, but since we already
// have the static InitializeOneOff here, it's easiest to reuse its
@@ -30,6 +29,8 @@ class GL_EXPORT GLSurfaceGLX : public GLSurface {
static bool HasGLXExtension(const char* name);
static bool IsCreateContextRobustnessSupported();
+ virtual void* GetDisplay();
+
// Get the FB config that the surface was created with or NULL if it is not
// a GLX drawable.
virtual void* GetConfig() = 0;
diff --git a/ui/gfx/gl/gl_surface_osmesa.cc b/ui/gfx/gl/gl_surface_osmesa.cc
index 3fdf8fb..2fe5e38 100644
--- a/ui/gfx/gl/gl_surface_osmesa.cc
+++ b/ui/gfx/gl/gl_surface_osmesa.cc
@@ -17,9 +17,9 @@ GLSurfaceOSMesa::~GLSurfaceOSMesa() {
Destroy();
}
-void GLSurfaceOSMesa::Resize(const gfx::Size& new_size) {
+bool GLSurfaceOSMesa::Resize(const gfx::Size& new_size) {
if (new_size == size_)
- return;
+ return true;
// Preserve the old buffer.
scoped_array<int32> old_buffer(buffer_.release());
@@ -37,6 +37,7 @@ void GLSurfaceOSMesa::Resize(const gfx::Size& new_size) {
}
size_ = new_size;
+ return true;
}
bool GLSurfaceOSMesa::Initialize() {
diff --git a/ui/gfx/gl/gl_surface_osmesa.h b/ui/gfx/gl/gl_surface_osmesa.h
index 14897c2..f0a4663 100644
--- a/ui/gfx/gl/gl_surface_osmesa.h
+++ b/ui/gfx/gl/gl_surface_osmesa.h
@@ -22,7 +22,7 @@ class GL_EXPORT GLSurfaceOSMesa : public GLSurface {
// Resize the back buffer, preserving the old content. Does nothing if the
// size is unchanged.
- void Resize(const gfx::Size& new_size);
+ virtual bool Resize(const gfx::Size& new_size);
// Implement GLSurface.
virtual bool Initialize();
@@ -31,9 +31,7 @@ class GL_EXPORT GLSurfaceOSMesa : public GLSurface {
virtual bool SwapBuffers();
virtual gfx::Size GetSize();
virtual void* GetHandle();
-
- // Get the surface's format.
- unsigned GetFormat();
+ virtual unsigned GetFormat();
private:
void AllocateBuffer(const Size& size);
diff --git a/ui/gfx/gl/gl_surface_wgl.cc b/ui/gfx/gl/gl_surface_wgl.cc
index 52772ff..9c774d4 100644
--- a/ui/gfx/gl/gl_surface_wgl.cc
+++ b/ui/gfx/gl/gl_surface_wgl.cc
@@ -60,6 +60,10 @@ GLSurfaceWGL::GLSurfaceWGL() {
GLSurfaceWGL::~GLSurfaceWGL() {
}
+void* GLSurfaceWGL::GetDisplay() {
+ return g_display_dc;
+}
+
bool GLSurfaceWGL::InitializeOneOff() {
static bool initialized = false;
if (initialized)
@@ -162,7 +166,7 @@ bool GLSurfaceWGL::InitializeOneOff() {
return true;
}
-HDC GLSurfaceWGL::GetDisplay() {
+HDC GLSurfaceWGL::GetDisplayDC() {
return g_display_dc;
}
diff --git a/ui/gfx/gl/gl_surface_wgl.h b/ui/gfx/gl/gl_surface_wgl.h
index bb4b71b..7a4ed69 100644
--- a/ui/gfx/gl/gl_surface_wgl.h
+++ b/ui/gfx/gl/gl_surface_wgl.h
@@ -16,8 +16,11 @@ class GLSurfaceWGL : public GLSurface {
GLSurfaceWGL();
virtual ~GLSurfaceWGL();
+ // Implement GLSurface.
+ virtual void* GetDisplay();
+
static bool InitializeOneOff();
- static HDC GetDisplay();
+ static HDC GetDisplayDC();
private:
DISALLOW_COPY_AND_ASSIGN(GLSurfaceWGL);