diff options
Diffstat (limited to 'src/core/surface_factory_qt.cpp')
-rw-r--r-- | src/core/surface_factory_qt.cpp | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/src/core/surface_factory_qt.cpp b/src/core/surface_factory_qt.cpp index e8be84807..6e5e13866 100644 --- a/src/core/surface_factory_qt.cpp +++ b/src/core/surface_factory_qt.cpp @@ -44,7 +44,12 @@ #include "base/files/file_path.h" #include "base/native_library.h" +#include "ui/gl/gl_context_egl.h" #include "ui/gl/gl_implementation.h" +#include "ui/gl/gl_surface.h" +#include "ui/gl/init/gl_initializer.h" +#include "ui/gl/init/gl_factory.h" +#include "ui/ozone/common/gl_ozone_egl.h" #include <QGuiApplication> @@ -55,7 +60,38 @@ namespace QtWebEngineCore { -bool SurfaceFactoryQt::LoadEGLGLES2Bindings() +class GLOzoneQt : public ui::GLOzoneEGL { +public: + scoped_refptr<gl::GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget /*window*/) override + { + return nullptr; + } + scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface(const gfx::Size& /*size*/) override + { + return nullptr; + } + +protected: + // Returns native platform display handle. This is used to obtain the EGL + // display connection for the native display. + intptr_t GetNativeDisplay() override; + + // Sets up GL bindings for the native surface. + bool LoadGLES2Bindings() override; + +}; + +base::NativeLibrary LoadLibrary(const base::FilePath& filename) { + base::NativeLibraryLoadError error; + base::NativeLibrary library = base::LoadNativeLibrary(filename, &error); + if (!library) { + LOG(ERROR) << "Failed to load " << filename.MaybeAsASCII() << ": " << error.ToString(); + return NULL; + } + return library; +} + +bool GLOzoneQt::LoadGLES2Bindings() { base::NativeLibrary eglgles2Library = dlopen(NULL, RTLD_LAZY); if (!eglgles2Library) { @@ -75,7 +111,7 @@ bool SurfaceFactoryQt::LoadEGLGLES2Bindings() return true; } -intptr_t SurfaceFactoryQt::GetNativeDisplay() +intptr_t GLOzoneQt::GetNativeDisplay() { static void *display = GLContextHelper::getNativeDisplay(); @@ -85,6 +121,18 @@ intptr_t SurfaceFactoryQt::GetNativeDisplay() return reinterpret_cast<intptr_t>(EGL_DEFAULT_DISPLAY); } +std::vector<gl::GLImplementation> SurfaceFactoryQt::GetAllowedGLImplementations() +{ + std::vector<gl::GLImplementation> impls; + impls.push_back(gl::kGLImplementationEGLGLES2); + return impls; +} + +ui::GLOzone* SurfaceFactoryQt::GetGLOzone(gl::GLImplementation implementation) +{ + return new GLOzoneQt(); +} + } // namespace QtWebEngineCore #endif // defined(USE_OZONE) |