summaryrefslogtreecommitdiffstats
path: root/src/opengl/qgraphicssystem_gl.cpp
diff options
context:
space:
mode:
authorMartin Smith <msmith@trolltech.com>2010-04-27 08:45:30 (GMT)
committerMartin Smith <msmith@trolltech.com>2010-04-27 08:45:30 (GMT)
commit9cea45515ef283c9a870c6f515da50d31addafcf (patch)
treed14fdf2b17a2a52c90ac514c39ad60be200cc7d7 /src/opengl/qgraphicssystem_gl.cpp
parent6749edd4c6f647c4963793183a452bb1ae769c1c (diff)
parent13dff164d2ab13b1258d31693b67acebc8636890 (diff)
downloadQt-9cea45515ef283c9a870c6f515da50d31addafcf.zip
Qt-9cea45515ef283c9a870c6f515da50d31addafcf.tar.gz
Qt-9cea45515ef283c9a870c6f515da50d31addafcf.tar.bz2
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'src/opengl/qgraphicssystem_gl.cpp')
-rw-r--r--src/opengl/qgraphicssystem_gl.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/opengl/qgraphicssystem_gl.cpp b/src/opengl/qgraphicssystem_gl.cpp
index a282e4c..58cc28a 100644
--- a/src/opengl/qgraphicssystem_gl.cpp
+++ b/src/opengl/qgraphicssystem_gl.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qgraphicssystem_gl_p.h"
+#include <QGraphicsView>
#include "private/qpixmap_raster_p.h"
#include "private/qpixmapdata_gl_p.h"
@@ -47,7 +48,7 @@
#include "private/qgl_p.h"
#include <private/qwindowsurface_raster_p.h>
-#if defined(Q_WS_X11) && defined(QT_OPENGL_ES)
+#if defined(Q_WS_X11) && !defined(QT_NO_EGL)
#include "private/qpixmapdata_x11gl_p.h"
#include "private/qwindowsurface_x11gl_p.h"
#endif
@@ -58,10 +59,6 @@ extern QGLWidget *qt_gl_getShareWidget();
QPixmapData *QGLGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
{
-#if defined(Q_WS_X11) && defined(QT_OPENGL_ES)
- if (type == QPixmapData::PixmapType && QX11GLPixmapData::hasX11GLPixmaps())
- return new QX11GLPixmapData();
-#endif
return new QGLPixmapData(type);
}
@@ -75,9 +72,18 @@ QWindowSurface *QGLGraphicsSystem::createWindowSurface(QWidget *widget) const
return new QRasterWindowSurface(widget);
#endif
-#if defined(Q_WS_X11) && defined(QT_OPENGL_ES)
- if (QX11GLPixmapData::hasX11GLPixmaps())
- return new QX11GLWindowSurface(widget);
+#if defined(Q_WS_X11) && !defined(QT_NO_EGL)
+ if (m_useX11GL && QX11GLPixmapData::hasX11GLPixmaps()) {
+ // If the widget is a QGraphicsView which will be re-drawing the entire
+ // scene each frame anyway, we should use QGLWindowSurface as this may
+ // provide proper buffer flipping, which should be faster than QX11GL's
+ // blitting approach:
+ QGraphicsView* qgv = qobject_cast<QGraphicsView*>(widget);
+ if (qgv && qgv->viewportUpdateMode() == QGraphicsView::FullViewportUpdate)
+ return new QGLWindowSurface(widget);
+ else
+ return new QX11GLWindowSurface(widget);
+ }
#endif
return new QGLWindowSurface(widget);