diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-07-22 16:11:22 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-23 16:24:01 +0200 |
commit | d5ade9de78ef6a234152308db67dfca34294e191 (patch) | |
tree | da8c0a7579114fab5ec8c971e90535b4e03873cd /Source/WebCore/platform | |
parent | c00313189427c6f3db679d573a19f6c1cf0c5df2 (diff) |
[Qt] Avoid creating a QWindow for offscreen GraphicsContext3D
https://bugs.webkit.org/show_bug.cgi?id=118244
Reviewed by Noam Rosenthal.
In Qt 5.0 we had to create invisible windows, but in Qt 5.1
we can now create specific offscreen surfaces.
* platform/graphics/qt/GraphicsContext3DQt.cpp:
(WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
Change-Id: Ib5b6adadc1e60ec43883ac61595afbd4e43c5d4a
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152222 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'Source/WebCore/platform')
-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; |