From d02852416998d0765f3cb4c8a36c33ca046c34b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 17 Sep 2010 09:55:25 +0200 Subject: Make raster the default graphics system on X11. The raster graphicssystem in most cases performs better than the native graphicssystem. Results from tests/benchmarks/gui/painting/qtracebench below: Before change: RESULT : tst_QTraceBench::trace():"basicdrawing": 46 msecs RESULT : tst_QTraceBench::trace():"webkit": 20 msecs RESULT : tst_QTraceBench::trace():"creator": 62 msecs RESULT : tst_QTraceBench::trace():"textedit": 3 msecs RESULT : tst_QTraceBench::trace():"qmlphoneconcept": 713 msecs RESULT : tst_QTraceBench::trace():"qmlsamegame": 88 msecs After change: RESULT : tst_QTraceBench::trace():"basicdrawing": 40 msecs RESULT : tst_QTraceBench::trace():"webkit": 11 msecs RESULT : tst_QTraceBench::trace():"creator": 19 msecs RESULT : tst_QTraceBench::trace():"textedit": 5 msecs RESULT : tst_QTraceBench::trace():"qmlphoneconcept": 141 msecs RESULT : tst_QTraceBench::trace():"qmlsamegame": 3 msecs Reviewed-by: Gunnar Sletta --- src/gui/image/qpixmap.cpp | 5 +++++ src/gui/painting/qgraphicssystemfactory.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index d5db431..0445b46 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1170,7 +1170,12 @@ QPixmap QPixmap::grabWidget(QWidget * widget, const QRect &rect) \warning This function is X11 specific; using it is non-portable. + \warning Since 4.8, pixmaps do not have an X11 handle unless + created with \l {QPixmap::}{fromX11Pixmap()}, or if the native + graphics system is explicitly enabled. + \sa detach() + \sa QApplication::setGraphicsSystem() */ Qt::HANDLE QPixmap::handle() const diff --git a/src/gui/painting/qgraphicssystemfactory.cpp b/src/gui/painting/qgraphicssystemfactory.cpp index ee6fbd8..3adeba4 100644 --- a/src/gui/painting/qgraphicssystemfactory.cpp +++ b/src/gui/painting/qgraphicssystemfactory.cpp @@ -73,7 +73,7 @@ QGraphicsSystem *QGraphicsSystemFactory::create(const QString& key) if (system.isEmpty()) { system = QLatin1String("runtime"); } -#elif defined (QT_GRAPHICSSYSTEM_RASTER) && !defined(Q_WS_WIN) && !defined(Q_OS_SYMBIAN) +#elif defined (QT_GRAPHICSSYSTEM_RASTER) && !defined(Q_WS_WIN) && !defined(Q_OS_SYMBIAN) || defined(Q_WS_X11) if (system.isEmpty()) { system = QLatin1String("raster"); } -- cgit v0.12 From d9d62f176bddc62d9ec0d3b91654bd1d331416a0 Mon Sep 17 00:00:00 2001 From: Arvid Ephraim Picciani Date: Fri, 17 Sep 2010 15:43:19 +0200 Subject: QThreadPool: name pooled threads Task-Number: QTBUG-13702 Reviewed-by: Andy Shaw Reviewed-by: ossi --- src/corelib/concurrent/qthreadpool.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/concurrent/qthreadpool.cpp b/src/corelib/concurrent/qthreadpool.cpp index f25a494..265de33 100644 --- a/src/corelib/concurrent/qthreadpool.cpp +++ b/src/corelib/concurrent/qthreadpool.cpp @@ -250,6 +250,7 @@ bool QThreadPoolPrivate::tooManyThreadsActive() const void QThreadPoolPrivate::startThread(QRunnable *runnable) { QScopedPointer thread(new QThreadPoolThread(this)); + thread->setObjectName(QLatin1String("Thread (pooled)")); allThreads.insert(thread.data()); ++activeThreads; -- cgit v0.12 From 072be90e0240ec544a9f2910e7e1c6533d1efc68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Sat, 18 Sep 2010 11:26:24 +0200 Subject: Give a warning in QPixmap::handle() if pixmap is not X11 class. Reviewed-by: Markus Goetz --- src/gui/image/qpixmap.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 0445b46..04c53f9 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1182,8 +1182,12 @@ Qt::HANDLE QPixmap::handle() const { #if defined(Q_WS_X11) const QPixmapData *pd = pixmapData(); - if (pd && pd->classId() == QPixmapData::X11Class) - return static_cast(pd)->handle(); + if (pd) { + if (pd->classId() == QPixmapData::X11Class) + return static_cast(pd)->handle(); + else + qWarning("QPixmap::handle(): Pixmap is not an X11 class pixmap"); + } #endif return 0; } -- cgit v0.12 From 4119428bff5c7342d134824bd18f2b2c54df1396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 20 Sep 2010 12:58:33 +0200 Subject: Fixed QStaticText auto-test to work with raster graphicssystem. Reviewed-by: Eskil --- tests/auto/qstatictext/tst_qstatictext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp index 49d6633..6a78cb8 100644 --- a/tests/auto/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/qstatictext/tst_qstatictext.cpp @@ -359,7 +359,7 @@ bool tst_QStaticText::supportsTransformations() const QPaintEngine::Type type = engine->type(); if (type == QPaintEngine::OpenGL -#if !defined Q_WS_WIN +#if !defined(Q_WS_WIN) && !defined(Q_WS_X11) || type == QPaintEngine::Raster #endif ) -- cgit v0.12 From 227bc692ec6e881b737f911071c912de4d01f55c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 20 Sep 2010 12:57:27 +0200 Subject: Fixed qdeclarativetext auto-test to work with raster graphicssystem. Updated the expected images in a few cases where the rounding differed. Reviewed-by: Eskil --- .../declarative/qdeclarativetext/data/alignments_cb.png | Bin 496 -> 496 bytes .../declarative/qdeclarativetext/data/alignments_cc.png | Bin 556 -> 556 bytes .../declarative/qdeclarativetext/data/alignments_ct.png | Bin 533 -> 533 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_cb.png b/tests/auto/declarative/qdeclarativetext/data/alignments_cb.png index 99de219..b5c6bba 100644 Binary files a/tests/auto/declarative/qdeclarativetext/data/alignments_cb.png and b/tests/auto/declarative/qdeclarativetext/data/alignments_cb.png differ diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_cc.png b/tests/auto/declarative/qdeclarativetext/data/alignments_cc.png index cb85251..c9ffcc1 100644 Binary files a/tests/auto/declarative/qdeclarativetext/data/alignments_cc.png and b/tests/auto/declarative/qdeclarativetext/data/alignments_cc.png differ diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_ct.png b/tests/auto/declarative/qdeclarativetext/data/alignments_ct.png index ddca549..eda0d25 100644 Binary files a/tests/auto/declarative/qdeclarativetext/data/alignments_ct.png and b/tests/auto/declarative/qdeclarativetext/data/alignments_ct.png differ -- cgit v0.12 From 6a9fced05be98e7acedc47711e8fce1dc795e764 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 20 Sep 2010 12:41:53 +0200 Subject: Make QStaticText honor QPainter::pen() for rich text on X11 w/raster The document layou will call setPen() with the PaintContext's text color. If this is different from the current painter settings, the pen will be passed on to the paint engine. The result was that, on X11 using the raster (or opengl) engine, QStaticText would record the pen as changed even when it hadn't explicitly been changed by the document. Task-number: QTBUG-13740 Reviewed-by: Samuel --- src/gui/text/qstatictext.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index b950b13..2eeafd2 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -43,6 +43,7 @@ #include "qstatictext_p.h" #include #include +#include #include @@ -655,7 +656,9 @@ void QStaticTextPrivate::paintText(const QPointF &topLeftPosition, QPainter *p) p->save(); p->translate(topLeftPosition); - document.drawContents(p); + QAbstractTextDocumentLayout::PaintContext ctx; + ctx.palette.setColor(QPalette::Text, p->pen().color()); + document.documentLayout()->draw(p, ctx); p->restore(); if (textWidth >= 0.0) -- cgit v0.12 From 30e8b82d74c4c57b60f2f06b61254de6572eaecf Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 21 Sep 2010 12:34:26 +0200 Subject: Rename some variables to improve readability. Review-by: Denis Dzyubenko --- src/gui/kernel/qgesturemanager.cpp | 41 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 5c80340..fb1a1d6 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -239,52 +239,53 @@ bool QGestureManager::filterEventThroughContexts(const QMultiMap::const_iterator ContextIterator; - for (ContextIterator cit = contexts.begin(), ce = contexts.end(); cit != ce; ++cit) { - Qt::GestureType gestureType = cit.value(); + ContextIterator contextEnd = contexts.end(); + for (ContextIterator context = contexts.begin(); context != contextEnd; ++context) { + Qt::GestureType gestureType = context.value(); QMap::const_iterator - rit = m_recognizers.lowerBound(gestureType), - re = m_recognizers.upperBound(gestureType); - for (; rit != re; ++rit) { - QGestureRecognizer *recognizer = rit.value(); - QObject *target = cit.key(); + typeToRecognizerIterator = m_recognizers.lowerBound(gestureType), + typeToRecognizerEnd = m_recognizers.upperBound(gestureType); + for (; typeToRecognizerIterator != typeToRecognizerEnd; ++typeToRecognizerIterator) { + QGestureRecognizer *recognizer = typeToRecognizerIterator.value(); + QObject *target = context.key(); QGesture *state = getState(target, recognizer, gestureType); if (!state) continue; - QGestureRecognizer::Result result = recognizer->recognize(state, target, event); - QGestureRecognizer::Result type = result & QGestureRecognizer::ResultState_Mask; - result &= QGestureRecognizer::ResultHint_Mask; - if (type == QGestureRecognizer::TriggerGesture) { + QGestureRecognizer::Result recognizerResult = recognizer->recognize(state, target, event); + QGestureRecognizer::Result recognizerState = recognizerResult & QGestureRecognizer::ResultState_Mask; + QGestureRecognizer::Result resultHint = recognizerResult & QGestureRecognizer::ResultHint_Mask; + if (recognizerState == QGestureRecognizer::TriggerGesture) { DEBUG() << "QGestureManager:Recognizer: gesture triggered: " << state; triggeredGestures << state; - } else if (type == QGestureRecognizer::FinishGesture) { + } else if (recognizerState == QGestureRecognizer::FinishGesture) { DEBUG() << "QGestureManager:Recognizer: gesture finished: " << state; finishedGestures << state; - } else if (type == QGestureRecognizer::MayBeGesture) { + } else if (recognizerState == QGestureRecognizer::MayBeGesture) { DEBUG() << "QGestureManager:Recognizer: maybe gesture: " << state; newMaybeGestures << state; - } else if (type == QGestureRecognizer::CancelGesture) { + } else if (recognizerState == QGestureRecognizer::CancelGesture) { DEBUG() << "QGestureManager:Recognizer: not gesture: " << state; notGestures << state; - } else if (type == QGestureRecognizer::Ignore) { + } else if (recognizerState == QGestureRecognizer::Ignore) { DEBUG() << "QGestureManager:Recognizer: ignored the event: " << state; } else { DEBUG() << "QGestureManager:Recognizer: hm, lets assume the recognizer" << "ignored the event: " << state; } - if (result & QGestureRecognizer::ConsumeEventHint) { + if (resultHint & QGestureRecognizer::ConsumeEventHint) { DEBUG() << "QGestureManager: we were asked to consume the event: " << state; - ret = true; + consumeEventHint = true; } } } if (triggeredGestures.isEmpty() && finishedGestures.isEmpty() && newMaybeGestures.isEmpty() && notGestures.isEmpty()) - return ret; + return consumeEventHint; QSet startedGestures = triggeredGestures - m_activeGestures; triggeredGestures &= m_activeGestures; @@ -381,7 +382,7 @@ bool QGestureManager::filterEventThroughContexts(const QMultiMap