Index: ui/gl/gl_surface_egl.cc |
diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc |
index b99b7b4942c575610495eeac35f79b1a1d69d3bc..b2da76247828675f2159501bd0827fb38d02e765 100644 |
--- a/ui/gl/gl_surface_egl.cc |
+++ b/ui/gl/gl_surface_egl.cc |
@@ -15,6 +15,7 @@ |
#include "ui/gl/egl_util.h" |
#include "ui/gl/gl_context.h" |
#include "ui/gl/gl_implementation.h" |
+#include "ui/gl/gl_surface_osmesa.h" |
#include "ui/gl/gl_surface_stub.h" |
#include "ui/gl/scoped_make_current.h" |
@@ -564,6 +565,9 @@ PbufferGLSurfaceEGL::~PbufferGLSurfaceEGL() { |
// static |
bool GLSurface::InitializeOneOffInternal() { |
+ if (GetGLImplementation() == kGLImplementationOSMesaGL) { |
+ return true; |
+ } |
DCHECK(GetGLImplementation() == kGLImplementationEGLGLES2); |
if (!GLSurfaceEGL::InitializeOneOff()) { |
@@ -576,6 +580,13 @@ bool GLSurface::InitializeOneOffInternal() { |
// static |
scoped_refptr<GLSurface> |
GLSurface::CreateViewGLSurface(gfx::AcceleratedWidget window) { |
+ |
+ if (GetGLImplementation() == kGLImplementationOSMesaGL) { |
+ scoped_refptr<GLSurface> surface(new GLSurfaceOSMesaHeadless(window)); |
jonathan.backer
2013/06/27 17:13:28
Can we define this class in an anonymous namespace
rjkroege
2013/06/28 00:25:01
Yes. But there is a difficulty around this. gl_sur
jonathan.backer
2013/06/28 13:13:47
Thanks for the explanation. I have a slight prefer
|
+ if (!surface->Initialize()) |
+ return NULL; |
+ return surface; |
+ } |
DCHECK(GetGLImplementation() == kGLImplementationEGLGLES2); |
if (window) { |
scoped_refptr<NativeViewGLSurfaceEGL> surface; |
@@ -601,6 +612,13 @@ GLSurface::CreateViewGLSurface(gfx::AcceleratedWidget window) { |
scoped_refptr<GLSurface> |
GLSurface::CreateOffscreenGLSurface(const gfx::Size& size) { |
switch (GetGLImplementation()) { |
+ case kGLImplementationOSMesaGL: { |
+ scoped_refptr<GLSurface> surface(new GLSurfaceOSMesa(1, size)); |
+ if (!surface->Initialize()) |
+ return NULL; |
+ |
+ return surface; |
+ } |
case kGLImplementationEGLGLES2: { |
scoped_refptr<PbufferGLSurfaceEGL> surface( |
new PbufferGLSurfaceEGL(size)); |