diff options
Diffstat (limited to 'src/core/ozone/surface_factory_qt.cpp')
-rw-r--r-- | src/core/ozone/surface_factory_qt.cpp | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/core/ozone/surface_factory_qt.cpp b/src/core/ozone/surface_factory_qt.cpp index f21e14c30..9570852c9 100644 --- a/src/core/ozone/surface_factory_qt.cpp +++ b/src/core/ozone/surface_factory_qt.cpp @@ -37,6 +37,17 @@ ** ****************************************************************************/ +#include "surface_factory_qt.h" +#include "qtwebenginecoreglobal_p.h" +#include "gl_context_qt.h" +#include "gl_ozone_egl_qt.h" +#if QT_CONFIG(webengine_system_x11) +#include "gl_ozone_glx_qt.h" +#endif + +#include "ui/gl/gl_surface.h" +#include <QGuiApplication> + #if defined(USE_OZONE) #include "ozone/gl_ozone_egl_qt.h" @@ -44,16 +55,31 @@ #include "ui/gl/gl_surface.h" namespace QtWebEngineCore { +SurfaceFactoryQt::SurfaceFactoryQt() +{ + Q_ASSERT(qApp); +#if QT_CONFIG(webengine_system_x11) + if (GLContextHelper::getGlXConfig()) { + m_impl = gl::kGLImplementationDesktopGL; + m_ozone.reset(new ui::GLOzoneGLXQt()); + } else +#endif + if (GLContextHelper::getEGLConfig()) { + m_impl = gl::kGLImplementationEGLGLES2; + m_ozone.reset(new ui::GLOzoneEGLQt()); + } else { + qFatal("No suitable graphics backend found\n"); + } +} + std::vector<gl::GLImplementation> SurfaceFactoryQt::GetAllowedGLImplementations() { - std::vector<gl::GLImplementation> impls; - impls.push_back(gl::kGLImplementationEGLGLES2); - return impls; + return { m_impl }; } ui::GLOzone* SurfaceFactoryQt::GetGLOzone(gl::GLImplementation implementation) { - return new GLOzoneEGLQt(); + return m_ozone.get(); } } // namespace QtWebEngineCore |