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

Unified Diff: ui/gl/init/gl_factory_android.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.cc ('k') | ui/gl/init/gl_factory_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ui/gl/init/gl_factory.cc ('k') | ui/gl/init/gl_factory_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698