Title: [152969] trunk/Source/WebCore
Revision
152969
Author
[email protected]
Date
2013-07-22 07:04:54 -0700 (Mon, 22 Jul 2013)

Log Message

[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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (152968 => 152969)


--- trunk/Source/WebCore/ChangeLog	2013-07-22 14:02:32 UTC (rev 152968)
+++ trunk/Source/WebCore/ChangeLog	2013-07-22 14:04:54 UTC (rev 152969)
@@ -1,3 +1,21 @@
+2013-07-22  Allan Sandfeld Jensen  <[email protected]>
+
+        [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):
+
 2013-07-22  Gyuyoung Kim  <[email protected]>
 
         Introduce toSVGUseElement(), use it

Modified: trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp (152968 => 152969)


--- trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp	2013-07-22 14:02:32 UTC (rev 152968)
+++ trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp	2013-07-22 14:04:54 UTC (rev 152969)
@@ -120,6 +120,10 @@
         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 @@
 #endif
 
     m_platformContext = new QOpenGLContext(m_surfaceOwner);
+    if (shareContext)
+        m_platformContext->setShareContext(shareContext);
+
     if (!m_platformContext->create())
         return;
 
@@ -229,9 +236,10 @@
     m_context->markLayerComposited();
     blitMultisampleFramebufferAndRestoreContext();
 
+    if (textureMapper->accelerationMode() == TextureMapper::OpenGLMode) {
+        TextureMapperGL* texmapGL = static_cast<TextureMapperGL*>(textureMapper);
 #if USE(GRAPHICS_SURFACE)
-    ASSERT(m_graphicsSurface);
-    if (textureMapper->accelerationMode() == TextureMapper::OpenGLMode) {
+        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.
@@ -246,11 +254,14 @@
         // 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);
+#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;
     }
-#endif
 
     GraphicsContext* context = textureMapper->graphicsContext();
     QPainter* painter = context->platformContext();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to