diff options
| author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-08-26 16:07:18 +0200 |
|---|---|---|
| committer | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-08-26 17:05:29 +0200 |
| commit | 584764ff763588ebded05db7d371f277081af086 (patch) | |
| tree | 5905b100c46a726e6abc5ac6b47b5574175870d4 /Source | |
| parent | 2af1a74f58d22bea134b8b5aab60ee8a170fb48f (diff) | |
| download | qtwebkit-584764ff763588ebded05db7d371f277081af086.tar.gz | |
Do not use graphics surface when painting WebGL in WebKitWidgets
Copying the texture to a surface and then painting the surface to the
texture mapper is needlessly complicated when we can paint the texture
directly.
This reduces overhead and fixes issues on drivers where graphics
surfaces do not work.
Change-Id: I6d2c935f7f2f98c56b66748f70eb37cc9c720f8d
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp index 87ba95396..1e57fd386 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp @@ -229,28 +229,9 @@ void GraphicsContext3DPrivate::paintToTextureMapper(TextureMapper* textureMapper 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. - QOpenGLContext* currentContext = QOpenGLContext::currentContext(); - QSurface* currentSurface = currentContext->surface(); - makeCurrentIfNeeded(); - - m_graphicsSurface->copyFromTexture(m_context->m_texture, IntRect(0, 0, m_context->m_currentWidth, m_context->m_currentHeight)); - - // 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. - currentContext->makeCurrent(currentSurface); - - m_graphicsSurface->paintToTextureMapper(texmapGL, targetRect, matrix, opacity); -#else TextureMapperGL::Flags flags = TextureMapperGL::ShouldFlipTexture | (m_context->m_attrs.alpha ? TextureMapperGL::ShouldBlend : 0); IntSize textureSize(m_context->m_currentWidth, m_context->m_currentHeight); texmapGL->drawTexture(m_context->m_texture, flags, textureSize, targetRect, matrix, opacity); -#endif return; } @@ -267,6 +248,7 @@ void GraphicsContext3DPrivate::paintToTextureMapper(TextureMapper* textureMapper QImage offscreenImage(width, height, QImage::Format_ARGB32); quint32* imagePixels = reinterpret_cast<quint32*>(offscreenImage.bits()); + painter->beginNativePainting(); makeCurrentIfNeeded(); glBindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_context->m_fbo); glReadPixels(/* x */ 0, /* y */ 0, width, height, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, imagePixels); @@ -293,6 +275,7 @@ void GraphicsContext3DPrivate::paintToTextureMapper(TextureMapper* textureMapper ++pixelsSrc; } } + painter->endNativePainting(); painter->drawImage(targetRect, offscreenImage); painter->restore(); |
