| Index: ui/gl/init/gl_factory_android.cc
|
| diff --git a/ui/gl/init/gl_factory_android.cc b/ui/gl/init/gl_factory_android.cc
|
| index 2f46db9358e3ecffe4a11fc97b1027b0f2b644c5..3446a1bd439d12f5bec12c48d02a804f53f27256 100644
|
| --- a/ui/gl/init/gl_factory_android.cc
|
| +++ b/ui/gl/init/gl_factory_android.cc
|
| @@ -14,6 +14,9 @@
|
| #include "ui/gl/gl_implementation.h"
|
| #include "ui/gl/gl_share_group.h"
|
| #include "ui/gl/gl_surface.h"
|
| +#include "ui/gl/gl_surface_egl.h"
|
| +#include "ui/gl/gl_surface_osmesa.h"
|
| +#include "ui/gl/gl_surface_stub.h"
|
|
|
| namespace gl {
|
| namespace init {
|
| @@ -69,7 +72,7 @@ std::string GLNonOwnedContext::GetExtensions() {
|
| return GLContext::GetExtensions() + " " + extensions;
|
| }
|
|
|
| -} // anonymous namespace
|
| +} // namespace
|
|
|
| scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
|
| GLSurface* compatible_surface,
|
| @@ -92,5 +95,48 @@ scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
|
| }
|
| }
|
|
|
| +scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) {
|
| + TRACE_EVENT0("gpu", "gl::init::CreateViewGLSurface");
|
| + CHECK_NE(kGLImplementationNone, GetGLImplementation());
|
| + switch (GetGLImplementation()) {
|
| + case kGLImplementationOSMesaGL:
|
| + return InitializeGLSurface(new GLSurfaceOSMesaHeadless());
|
| + case kGLImplementationEGLGLES2:
|
| + if (window != gfx::kNullAcceleratedWidget) {
|
| + return InitializeGLSurface(new NativeViewGLSurfaceEGL(window));
|
| + } else {
|
| + return InitializeGLSurface(new GLSurfaceStub());
|
| + }
|
| + default:
|
| + NOTREACHED();
|
| + return nullptr;
|
| + }
|
| +}
|
| +
|
| +scoped_refptr<GLSurface> CreateOffscreenGLSurface(const gfx::Size& size) {
|
| + TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface");
|
| + CHECK_NE(kGLImplementationNone, GetGLImplementation());
|
| + switch (GetGLImplementation()) {
|
| + case kGLImplementationOSMesaGL: {
|
| + return InitializeGLSurface(
|
| + new GLSurfaceOSMesa(GLSurface::SURFACE_OSMESA_BGRA, size));
|
| + }
|
| + case kGLImplementationEGLGLES2: {
|
| + scoped_refptr<GLSurface> surface;
|
| + if (GLSurfaceEGL::IsEGLSurfacelessContextSupported() &&
|
| + (size.width() == 0 && size.height() == 0)) {
|
| + return InitializeGLSurface(new SurfacelessEGL(size));
|
| + } else {
|
| + return InitializeGLSurface(new PbufferGLSurfaceEGL(size));
|
| + }
|
| + }
|
| + case kGLImplementationMockGL:
|
| + return new GLSurfaceStub;
|
| + default:
|
| + NOTREACHED();
|
| + return nullptr;
|
| + }
|
| +}
|
| +
|
| } // namespace init
|
| } // namespace gl
|
|
|