diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-07-22 16:20:20 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-24 13:58:22 +0200 |
commit | 84d199a4535bd5ae3fe7414f53ceaba839f6a74e (patch) | |
tree | 50854ced41c706a35c2f43dbcf79382ebc699494 /Source | |
parent | 34b83124246532f99dcad6cfd3fd3db93eb9a169 (diff) | |
download | qtwebkit-84d199a4535bd5ae3fe7414f53ceaba839f6a74e.tar.gz |
[Qt][WK1] Support direct painting without GraphicsSurface
https://bugs.webkit.org/show_bug.cgi?id=118302
Reviewed by Jocelyn Turcotte.
Configure the WebGL OpenGL context to share texture with
the HostWindow OpenGL if available, and paint accelerated
using the the now shared textures.
This should return the performance without GraphicsSurface
on the WK1 code path to what it was before r135995 (28/11 2012).
* platform/graphics/qt/GraphicsContext3DQt.cpp:
(WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
(WebCore::GraphicsContext3DPrivate::paintToTextureMapper):
Change-Id: I3b2cdf2d06702c18b21a62eed0f6821d08033ec7
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152969 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'Source')
-rw-r--r-- | Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp index d0492aff5..8a8c77074 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp @@ -120,6 +120,10 @@ GraphicsContext3DPrivate::GraphicsContext3DPrivate(GraphicsContext3D* context, H return; } + QOpenGLContext* shareContext = 0; + if (hostWindow && hostWindow->platformPageClient() && hostWindow->platformPageClient()->makeOpenGLContextCurrentIfAvailable()) + shareContext = QOpenGLContext::currentContext(); + #if QT_VERSION >= 0x050100 QOffscreenSurface* surface = new QOffscreenSurface; surface->create(); @@ -135,6 +139,9 @@ GraphicsContext3DPrivate::GraphicsContext3DPrivate(GraphicsContext3D* context, H #endif m_platformContext = new QOpenGLContext(m_surfaceOwner); + if (shareContext) + m_platformContext->setShareContext(shareContext); + if (!m_platformContext->create()) return; @@ -224,9 +231,10 @@ void GraphicsContext3DPrivate::paintToTextureMapper(TextureMapper* textureMapper { blitMultisampleFramebufferAndRestoreContext(); -#if USE(GRAPHICS_SURFACE) - ASSERT(m_graphicsSurface); if (textureMapper->accelerationMode() == TextureMapper::OpenGLMode) { + TextureMapperGL* texmapGL = static_cast<TextureMapperGL*>(textureMapper); +#if USE(GRAPHICS_SURFACE) + ASSERT(m_graphicsSurface); // CGL only provides us the context, but not the view the context is currently bound to. // To make sure the context is bound the the right surface we have to do a makeCurrent through QOpenGL again. // FIXME: Remove this code as soon as GraphicsSurfaceMac makes use of NSOpenGL. @@ -241,11 +249,14 @@ void GraphicsContext3DPrivate::paintToTextureMapper(TextureMapper* textureMapper // FIXME: Remove this code as soon as GraphicsSurfaceMac makes use of NSOpenGL. currentContext->makeCurrent(currentSurface); - TextureMapperGL* texmapGL = static_cast<TextureMapperGL*>(textureMapper); m_graphicsSurface->paintToTextureMapper(texmapGL, targetRect, matrix, opacity, mask); +#else + TextureMapperGL::Flags flags = TextureMapperGL::ShouldFlipTexture | (m_context->m_attrs.alpha ? TextureMapperGL::SupportsBlending : 0); + IntSize textureSize(m_context->m_currentWidth, m_context->m_currentHeight); + texmapGL->drawTexture(m_context->m_texture, flags, textureSize, targetRect, matrix, opacity, mask); +#endif return; } -#endif GraphicsContext* context = textureMapper->graphicsContext(); QPainter* painter = context->platformContext(); |