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

Unified Diff: ui/ozone/platform/x11/x11_surface_factory.cc

Issue 2270463002: Add OzoneGLImpl interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 3 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/x11/x11_surface_factory.h ('k') | ui/ozone/public/gl_ozone.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/x11/x11_surface_factory.cc
diff --git a/ui/ozone/platform/x11/x11_surface_factory.cc b/ui/ozone/platform/x11/x11_surface_factory.cc
index 4628d6d97a96dbef1a95f054af54c048546e2ff0..8cbec82836c5f9a6d031be4b726f6a448b9a9850 100644
--- a/ui/ozone/platform/x11/x11_surface_factory.cc
+++ b/ui/ozone/platform/x11/x11_surface_factory.cc
@@ -11,6 +11,7 @@
#include "ui/gl/egl_util.h"
#include "ui/gl/gl_surface_egl.h"
#include "ui/ozone/common/egl_util.h"
+#include "ui/ozone/common/gl_ozone_egl.h"
namespace ui {
@@ -119,40 +120,55 @@ GLSurfaceEGLOzoneX11::~GLSurfaceEGLOzoneX11() {
Destroy();
}
-} // namespace
+class GLOzoneEGLX11 : public GLOzoneEGL {
+ public:
+ GLOzoneEGLX11() {}
+ ~GLOzoneEGLX11() override {}
-X11SurfaceFactory::X11SurfaceFactory() {}
+ scoped_refptr<gl::GLSurface> CreateViewGLSurface(
+ gfx::AcceleratedWidget window) override {
+ return gl::InitializeGLSurface(new GLSurfaceEGLOzoneX11(window));
+ }
-X11SurfaceFactory::~X11SurfaceFactory() {}
+ scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface(
+ const gfx::Size& size) override {
+ return gl::InitializeGLSurface(new gl::PbufferGLSurfaceEGL(size));
+ }
-scoped_refptr<gl::GLSurface> X11SurfaceFactory::CreateViewGLSurface(
- gl::GLImplementation implementation,
- gfx::AcceleratedWidget widget) {
- if (implementation != gl::kGLImplementationEGLGLES2) {
- NOTREACHED();
- return nullptr;
+ protected:
+ intptr_t GetNativeDisplay() override {
+ return reinterpret_cast<intptr_t>(gfx::GetXDisplay());
}
- return gl::InitializeGLSurface(new GLSurfaceEGLOzoneX11(widget));
-}
+ bool LoadGLES2Bindings() override { return LoadDefaultEGLGLES2Bindings(); }
-scoped_refptr<gl::GLSurface> X11SurfaceFactory::CreateOffscreenGLSurface(
- gl::GLImplementation implementation,
- const gfx::Size& size) {
- if (implementation != gl::kGLImplementationEGLGLES2) {
- NOTREACHED();
- return nullptr;
- }
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GLOzoneEGLX11);
+};
+
+} // namespace
- return gl::InitializeGLSurface(new gl::PbufferGLSurfaceEGL(size));
+X11SurfaceFactory::X11SurfaceFactory() {
+ egl_implementation_.reset(new GLOzoneEGLX11());
}
-bool X11SurfaceFactory::LoadEGLGLES2Bindings() {
- return LoadDefaultEGLGLES2Bindings();
+X11SurfaceFactory::~X11SurfaceFactory() {}
+
+std::vector<gl::GLImplementation>
+X11SurfaceFactory::GetAllowedGLImplementations() {
+ std::vector<gl::GLImplementation> impls;
+ impls.push_back(gl::kGLImplementationEGLGLES2);
+ impls.push_back(gl::kGLImplementationOSMesaGL);
+ return impls;
}
-intptr_t X11SurfaceFactory::GetNativeDisplay() {
- return reinterpret_cast<intptr_t>(gfx::GetXDisplay());
+GLOzone* X11SurfaceFactory::GetGLOzone(gl::GLImplementation implementation) {
+ switch (implementation) {
+ case gl::kGLImplementationEGLGLES2:
+ return egl_implementation_.get();
+ default:
+ return nullptr;
+ }
}
} // namespace ui
« no previous file with comments | « ui/ozone/platform/x11/x11_surface_factory.h ('k') | ui/ozone/public/gl_ozone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698