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

Unified Diff: ui/ozone/platform/wayland/wayland_surface_factory.cc

Issue 2187443003: Convert Ozone wayland to directly create GLSurfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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/ozone/platform/wayland/wayland_surface_factory.h ('k') | ui/ozone/public/surface_factory_ozone.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/wayland/wayland_surface_factory.cc
diff --git a/ui/ozone/platform/wayland/wayland_surface_factory.cc b/ui/ozone/platform/wayland/wayland_surface_factory.cc
index 1f5571dedc21e5fcc321b4ffee79121ed2298cf2..5c809ba3cb2710f463993c943dea569ce9b34683 100644
--- a/ui/ozone/platform/wayland/wayland_surface_factory.cc
+++ b/ui/ozone/platform/wayland/wayland_surface_factory.cc
@@ -20,7 +20,7 @@
#include "ui/ozone/public/surface_ozone_egl.h"
#if defined(USE_WAYLAND_EGL)
-#include "ui/ozone/platform/wayland/wayland_egl_surface.h"
+#include "ui/ozone/platform/wayland/gl_surface_wayland.h"
#endif
namespace ui {
@@ -132,6 +132,43 @@ WaylandSurfaceFactory::WaylandSurfaceFactory(WaylandConnection* connection)
WaylandSurfaceFactory::~WaylandSurfaceFactory() {}
+scoped_refptr<gl::GLSurface> WaylandSurfaceFactory::CreateViewGLSurface(
+ gl::GLImplementation implementation,
+ gfx::AcceleratedWidget widget) {
+ if (implementation != gl::kGLImplementationEGLGLES2) {
+ NOTREACHED();
+ return nullptr;
+ }
+
+#if defined(USE_WAYLAND_EGL)
+ WaylandWindow* window = connection_->GetWindow(widget);
+ DCHECK(window);
+ // The wl_egl_window needs to be created before the GLSurface so it can be
+ // used in the GLSurface constructor.
+ auto egl_window = CreateWaylandEglWindow(window);
+ if (!egl_window)
+ return nullptr;
+ return gl::InitializeGLSurface(new GLSurfaceWayland(std::move(egl_window)));
+#else
+ return nullptr;
+#endif
+}
+
+scoped_refptr<gl::GLSurface> WaylandSurfaceFactory::CreateOffscreenGLSurface(
+ gl::GLImplementation implementation,
+ const gfx::Size& size) {
+ if (implementation != gl::kGLImplementationEGLGLES2) {
+ NOTREACHED();
+ return nullptr;
+ }
+
+#if defined(USE_WAYLAND_EGL)
+ return gl::InitializeGLSurface(new gl::PbufferGLSurfaceEGL(size));
+#else
+ return nullptr;
+#endif
+}
+
intptr_t WaylandSurfaceFactory::GetNativeDisplay() {
return reinterpret_cast<intptr_t>(connection_->display());
}
@@ -156,22 +193,6 @@ WaylandSurfaceFactory::CreateCanvasForWidget(gfx::AcceleratedWidget widget) {
return base::WrapUnique(new WaylandCanvasSurface(connection_, window));
}
-std::unique_ptr<SurfaceOzoneEGL>
-WaylandSurfaceFactory::CreateEGLSurfaceForWidget(
- gfx::AcceleratedWidget widget) {
-#if defined(USE_WAYLAND_EGL)
- WaylandWindow* window = connection_->GetWindow(widget);
- DCHECK(window);
- auto surface = base::WrapUnique(
- new WaylandEGLSurface(window, window->GetBounds().size()));
- if (!surface->Initialize())
- return nullptr;
- return std::move(surface);
-#else
- return nullptr;
-#endif
-}
-
scoped_refptr<NativePixmap> WaylandSurfaceFactory::CreateNativePixmap(
gfx::AcceleratedWidget widget,
gfx::Size size,
« no previous file with comments | « ui/ozone/platform/wayland/wayland_surface_factory.h ('k') | ui/ozone/public/surface_factory_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698