Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(658)

Unified Diff: ui/gl/init/gl_factory_x11.cc

Issue 2047283003: Move GLSurface creation from //ui/gl to //ui/gl/init. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gl_context
Patch Set: Fix Ozone CreateViewGLSurface logic. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/init/gl_factory_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/init/gl_factory_x11.cc
diff --git a/ui/gl/init/gl_factory_x11.cc b/ui/gl/init/gl_factory_x11.cc
index 1bba83e21024b36250a68375292e30ce7bfc1f6a..21b07def7e8467c038190437a27b2f9c019bde8f 100644
--- a/ui/gl/init/gl_factory_x11.cc
+++ b/ui/gl/init/gl_factory_x11.cc
@@ -13,6 +13,12 @@
#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_egl_x11.h"
+#include "ui/gl/gl_surface_glx.h"
+#include "ui/gl/gl_surface_osmesa.h"
+#include "ui/gl/gl_surface_osmesa_x11.h"
+#include "ui/gl/gl_surface_stub.h"
namespace gl {
namespace init {
@@ -39,5 +45,41 @@ scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
}
}
+scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) {
+ TRACE_EVENT0("gpu", "gl::init::CreateViewGLSurface");
+ switch (GetGLImplementation()) {
+ case kGLImplementationOSMesaGL:
+ return InitializeGLSurface(new GLSurfaceOSMesaX11(window));
+ case kGLImplementationDesktopGL:
+ return InitializeGLSurface(new NativeViewGLSurfaceGLX(window));
+ case kGLImplementationEGLGLES2:
+ DCHECK(window != gfx::kNullAcceleratedWidget);
+ return InitializeGLSurface(new NativeViewGLSurfaceEGLX11(window));
+ case kGLImplementationMockGL:
+ return new GLSurfaceStub;
+ default:
+ NOTREACHED();
+ return nullptr;
+ }
+}
+
+scoped_refptr<GLSurface> CreateOffscreenGLSurface(const gfx::Size& size) {
+ TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface");
+ switch (GetGLImplementation()) {
+ case kGLImplementationOSMesaGL:
+ return InitializeGLSurface(
+ new GLSurfaceOSMesa(GLSurface::SURFACE_OSMESA_RGBA, size));
+ case kGLImplementationDesktopGL:
+ return InitializeGLSurface(new UnmappedNativeViewGLSurfaceGLX(size));
+ case kGLImplementationEGLGLES2:
+ return InitializeGLSurface(new PbufferGLSurfaceEGL(size));
+ case kGLImplementationMockGL:
+ return new GLSurfaceStub;
+ default:
+ NOTREACHED();
+ return nullptr;
+ }
+}
+
} // namespace init
} // namespace gl
« no previous file with comments | « ui/gl/init/gl_factory_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698