summaryrefslogtreecommitdiff
path: root/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp')
-rw-r--r--Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp
index 92ab84b64..369307cba 100644
--- a/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp
@@ -282,11 +282,16 @@ void PageClientQGraphicsWidget::setRootGraphicsLayer(GraphicsLayer* layer)
{
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());