summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-01-04 13:00:21 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-01-04 13:00:21 (GMT)
commitf8696912869c702ddc5ac664659346554e96addf (patch)
tree9fb756251cfb1b0d80d90f7ff7ecc9879e28586c
parent6b43d484c52c05a8404ef3e13084149b98bd794e (diff)
parent177f2a2f17251c22f57944e9dd100ec8515b891a (diff)
downloadQt-f8696912869c702ddc5ac664659346554e96addf.zip
Qt-f8696912869c702ddc5ac664659346554e96addf.tar.gz
Qt-f8696912869c702ddc5ac664659346554e96addf.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: QMeeGoGraphicsSystemHelper::setSwapBehavior implementation. Support for swap modes in QGLWindowSurface. Pre-create the GL share widget before window surface creation. QMeeGoSwitchEvent exported and static. Fixed first element being a LineToElement in QPainterPath::connectPath()
-rw-r--r--src/gui/painting/qpainterpath.cpp3
-rw-r--r--src/opengl/qwindowsurface_gl.cpp13
-rw-r--r--src/opengl/qwindowsurface_gl_p.h3
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.cpp8
-rw-r--r--tests/auto/qpainterpath/tst_qpainterpath.cpp26
-rw-r--r--tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp15
-rw-r--r--tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h18
-rw-r--r--tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro2
-rw-r--r--tools/qmeegographicssystemhelper/qmeegoswitchevent.h4
9 files changed, 81 insertions, 11 deletions
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index ffd0d5c..94e2cd4 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -1196,7 +1196,8 @@ void QPainterPath::connectPath(const QPainterPath &other)
int first = d->elements.size();
d->elements += other.d_func()->elements;
- d->elements[first].type = LineToElement;
+ if (first != 0)
+ d->elements[first].type = LineToElement;
// avoid duplicate points
if (first > 0 && QPointF(d->elements[first]) == QPointF(d->elements[first - 1])) {
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index 7dc7dc7..b8716ce 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -284,6 +284,7 @@ struct QGLWindowSurfacePrivate
};
QGLFormat QGLWindowSurface::surfaceFormat;
+QGLWindowSurface::SwapMode QGLWindowSurface::swapBehavior = QGLWindowSurface::AutomaticSwap;
void QGLWindowSurfaceGLPaintDevice::endPaint()
{
@@ -541,6 +542,9 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &
const GLenum target = GL_TEXTURE_2D;
Q_UNUSED(target);
+ if (QGLWindowSurface::swapBehavior == QGLWindowSurface::KillSwap)
+ return;
+
if (context()) {
context()->makeCurrent();
@@ -588,7 +592,14 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &
}
}
#endif
- bool doingPartialUpdate = hasPartialUpdateSupport() && br.width() * br.height() < parent->geometry().width() * parent->geometry().height() * 0.2;
+ bool doingPartialUpdate = false;
+ if (QGLWindowSurface::swapBehavior == QGLWindowSurface::AutomaticSwap)
+ doingPartialUpdate = hasPartialUpdateSupport() && br.width() * br.height() < parent->geometry().width() * parent->geometry().height() * 0.2;
+ else if (QGLWindowSurface::swapBehavior == QGLWindowSurface::AlwaysFullSwap)
+ doingPartialUpdate = false;
+ else if (QGLWindowSurface::swapBehavior == QGLWindowSurface::AlwaysPartialSwap)
+ doingPartialUpdate = hasPartialUpdateSupport();
+
QGLContext *ctx = reinterpret_cast<QGLContext *>(parent->d_func()->extraData()->glContext);
if (widget != window()) {
if (initializeOffscreenTexture(window()->size()))
diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h
index 6906f35..9b0bee3 100644
--- a/src/opengl/qwindowsurface_gl_p.h
+++ b/src/opengl/qwindowsurface_gl_p.h
@@ -102,6 +102,9 @@ public:
static QGLFormat surfaceFormat;
+ enum SwapMode { AutomaticSwap, AlwaysFullSwap, AlwaysPartialSwap, KillSwap };
+ static SwapMode swapBehavior;
+
private slots:
void deleted(QObject *object);
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
index 4a86082..b1a8f5f7 100644
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
@@ -75,6 +75,8 @@ QMeeGoGraphicsSystem::~QMeeGoGraphicsSystem()
QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const
{
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
+
QMeeGoGraphicsSystem::surfaceWasCreated = true;
QWindowSurface *surface = new QGLWindowSurface(widget);
return surface;
@@ -82,12 +84,6 @@ QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const
QPixmapData *QMeeGoGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
{
- // Long story short: without this it's possible to hit an
- // uninitialized paintDevice due to a Qt bug too complex to even
- // explain here... not to mention fix without going crazy.
- // MDK
- QGLShareContextScope ctx(qt_gl_share_widget()->context());
-
return new QRasterPixmapData(type);
}
diff --git a/tests/auto/qpainterpath/tst_qpainterpath.cpp b/tests/auto/qpainterpath/tst_qpainterpath.cpp
index d0cddda..66e6d10 100644
--- a/tests/auto/qpainterpath/tst_qpainterpath.cpp
+++ b/tests/auto/qpainterpath/tst_qpainterpath.cpp
@@ -107,6 +107,7 @@ private slots:
void operators();
void connectPathDuplicatePoint();
+ void connectPathMoveTo();
void translate();
};
@@ -1169,6 +1170,31 @@ void tst_QPainterPath::connectPathDuplicatePoint()
QCOMPARE(c, a);
}
+void tst_QPainterPath::connectPathMoveTo()
+{
+ QPainterPath path1;
+ QPainterPath path2;
+ QPainterPath path3;
+ QPainterPath path4;
+
+ path1.moveTo(1,1);
+
+ path2.moveTo(4,4);
+ path2.lineTo(5,6);
+ path2.lineTo(6,7);
+
+ path3.connectPath(path2);
+
+ path4.lineTo(5,5);
+
+ path1.connectPath(path2);
+
+ QVERIFY(path1.elementAt(0).type == QPainterPath::MoveToElement);
+ QVERIFY(path2.elementAt(0).type == QPainterPath::MoveToElement);
+ QVERIFY(path3.elementAt(0).type == QPainterPath::MoveToElement);
+ QVERIFY(path4.elementAt(0).type == QPainterPath::MoveToElement);
+}
+
void tst_QPainterPath::translate()
{
QPainterPath path;
diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp
index b660eb3..37cc417 100644
--- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp
+++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp
@@ -45,6 +45,7 @@
#include <private/qapplication_p.h>
#include <private/qgraphicssystem_runtime_p.h>
#include <private/qpixmap_raster_p.h>
+#include <private/qwindowsurface_gl_p.h>
#include "qmeegoruntime.h"
#include "qmeegoswitchevent.h"
@@ -153,3 +154,17 @@ void QMeeGoGraphicsSystemHelper::setTranslucent(bool translucent)
ENSURE_RUNNING_MEEGO;
QMeeGoRuntime::setTranslucent(translucent);
}
+
+void QMeeGoGraphicsSystemHelper::setSwapBehavior(SwapMode mode)
+{
+ ENSURE_RUNNING_MEEGO;
+
+ if (mode == AutomaticSwap)
+ QGLWindowSurface::swapBehavior = QGLWindowSurface::AutomaticSwap;
+ else if (mode == AlwaysFullSwap)
+ QGLWindowSurface::swapBehavior = QGLWindowSurface::AlwaysFullSwap;
+ else if (mode == AlwaysPartialSwap)
+ QGLWindowSurface::swapBehavior = QGLWindowSurface::AlwaysPartialSwap;
+ else if (mode == KillSwap)
+ QGLWindowSurface::swapBehavior = QGLWindowSurface::KillSwap;
+}
diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
index 6df3c22..c8dccc2 100644
--- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
+++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
@@ -186,6 +186,24 @@ public:
on the top-level widget *before* you show it instead.
*/
static void setTranslucent(bool translucent);
+
+ //! Used to specify the mode for swapping buffers in double-buffered GL rendering.
+ enum SwapMode {
+ AutomaticSwap, /**< Automatically choose netween full and partial updates (25% threshold) */
+ AlwaysFullSwap, /**< Always do a full swap even if partial updates support present */
+ AlwaysPartialSwap, /**< Always do a partial swap (if support present) no matter what threshold */
+ KillSwap /**< Do not perform buffer swapping at all (no picture) */
+ };
+
+ //! Sets the buffer swapping mode.
+ /*!
+ This can be only called when running with the meego graphics system.
+ The KillSwap mode can be specififed to effectively block painting.
+
+ This functionality should be used only by applications counting on a specific behavior.
+ Most applications should use the default automatic behavior.
+ */
+ static void setSwapBehavior(SwapMode mode);
};
#endif
diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro
index 360847e..7639ad7 100644
--- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro
+++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro
@@ -3,7 +3,7 @@ TARGET = QtMeeGoGraphicsSystemHelper
include(../../src/qbase.pri)
-QT += gui
+QT += gui opengl
INCLUDEPATH += '../../src/plugins/graphicssystems/meego'
HEADERS = qmeegographicssystemhelper.h qmeegooverlaywidget.h qmeegolivepixmap.h qmeegoruntime.h qmeegolivepixmap_p.h qmeegofencesync.h qmeegofencesync_p.h qmeegoswitchevent.h
diff --git a/tools/qmeegographicssystemhelper/qmeegoswitchevent.h b/tools/qmeegographicssystemhelper/qmeegoswitchevent.h
index 0ddbd3d..462182f 100644
--- a/tools/qmeegographicssystemhelper/qmeegoswitchevent.h
+++ b/tools/qmeegographicssystemhelper/qmeegoswitchevent.h
@@ -52,7 +52,7 @@
when going to software mode.
*/
-class QMeeGoSwitchEvent : public QEvent
+class Q_DECL_EXPORT QMeeGoSwitchEvent : public QEvent
{
public:
@@ -83,7 +83,7 @@ public:
The type is registered on first access. Use this to detect incoming
QMeeGoSwitchEvents.
*/
- QEvent::Type eventNumber();
+ static QEvent::Type eventNumber();
private:
QString name;