Title: [135700] trunk/Source/WebKit/qt
Revision
135700
Author
zeno.albis...@digia.com
Date
2012-11-26 03:00:03 -0800 (Mon, 26 Nov 2012)

Log Message

[Qt] Make sure the QGLWidget context is current when creating the TextureMapper.
https://bugs.webkit.org/show_bug.cgi?id=103142

When creating the TextureMapperGL for WK1 we have to make sure
that the GL context provided by the QGLWidget is current.
Otherwise the GraphicsContext3DQt created by TextureMapperGL will pick up
the wrong pointer by calling QOpenGLContext::currentContext().

Reviewed by Simon Hausmann.

* WebCoreSupport/PageClientQt.cpp:
(WebCore::PageClientQGraphicsWidget::setRootGraphicsLayer):

Modified Paths

Diff

Modified: trunk/Source/WebKit/qt/ChangeLog (135699 => 135700)


--- trunk/Source/WebKit/qt/ChangeLog	2012-11-26 10:53:58 UTC (rev 135699)
+++ trunk/Source/WebKit/qt/ChangeLog	2012-11-26 11:00:03 UTC (rev 135700)
@@ -1,3 +1,18 @@
+2012-11-26  Zeno Albisser  <z...@webkit.org>
+
+        [Qt] Make sure the QGLWidget context is current when creating the TextureMapper.
+        https://bugs.webkit.org/show_bug.cgi?id=103142
+
+        When creating the TextureMapperGL for WK1 we have to make sure
+        that the GL context provided by the QGLWidget is current.
+        Otherwise the GraphicsContext3DQt created by TextureMapperGL will pick up
+        the wrong pointer by calling QOpenGLContext::currentContext().
+
+        Reviewed by Simon Hausmann.
+
+        * WebCoreSupport/PageClientQt.cpp:
+        (WebCore::PageClientQGraphicsWidget::setRootGraphicsLayer):
+
 2012-11-26  Michael BrĂ¼ning  <michael.brun...@digia.com>
 
         [Qt] QStyleFacadeImp build break with latest Qt 5

Modified: trunk/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp (135699 => 135700)


--- trunk/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp	2012-11-26 10:53:58 UTC (rev 135699)
+++ trunk/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp	2012-11-26 11:00:03 UTC (rev 135700)
@@ -282,11 +282,16 @@
 {
     if (layer) {
         TextureMapperLayerClient = adoptPtr(new TextureMapperLayerClientQt(page->mainFrame(), layer));
-#if USE(TEXTURE_MAPPER_GL)
+#if USE(TEXTURE_MAPPER_GL) && defined(QT_OPENGL_LIB)
         QGraphicsView* graphicsView = view->scene()->views()[0];
-        if (graphicsView && graphicsView->viewport() && graphicsView->viewport()->inherits("QGLWidget")) {
-            TextureMapperLayerClient->setTextureMapper(TextureMapper::create(TextureMapper::OpenGLMode));
-            return;
+        if (graphicsView && graphicsView->viewport()) {
+            QGLWidget* glWidget = qobject_cast<QGLWidget*>(graphicsView->viewport());
+            if (glWidget) {
+                // The GL context belonging to the QGLWidget viewport must be current when TextureMapper is being created.
+                glWidget->makeCurrent();
+                TextureMapperLayerClient->setTextureMapper(TextureMapper::create(TextureMapper::OpenGLMode));
+                return;
+            }
         }
 #endif
         TextureMapperLayerClient->setTextureMapper(TextureMapper::create());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to