| 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
|
|
|