diff options
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp index ab4447232..7576b606f 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp @@ -34,11 +34,16 @@ #include "OpenGLShims.h" #include "QWebPageClient.h" #include "SharedBuffer.h" -#include <QWindow> #include <qpa/qplatformpixmap.h> #include <wtf/UnusedParam.h> #include <wtf/text/CString.h> +#if QT_VERSION >= 0x050100 +#include <QOffscreenSurface> +#else +#include <QWindow> +#endif + #if USE(TEXTURE_MAPPER_GL) #include <texmap/TextureMapperGL.h> #endif @@ -116,16 +121,21 @@ GraphicsContext3DPrivate::GraphicsContext3DPrivate(GraphicsContext3D* context, H } #if USE(GRAPHICS_SURFACE) - // FIXME: Find a way to create a QOpenGLContext without creating a QWindow at all. - // We need to create a surface in order to create a QOpenGLContext and make it current. +#if QT_VERSION >= 0x050100 + QOffscreenSurface* surface = new QOffscreenSurface; + surface->create(); + m_surface = surface; + m_surfaceOwner = surface; +#else QWindow* window = new QWindow; window->setSurfaceType(QSurface::OpenGLSurface); window->setGeometry(-10, -10, 1, 1); window->create(); m_surface = window; m_surfaceOwner = window; +#endif - m_platformContext = new QOpenGLContext(window); + m_platformContext = new QOpenGLContext(m_surfaceOwner); if (!m_platformContext->create()) return; |
