From f370dd07560c449ba17d13475721f7d3b46e6b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 30 May 2011 09:38:47 +0200 Subject: Fixed clipping errors for non-extended paint engines. Partially revert change a33ef62469fd71bec for the non-extended paint engine path. Task-number: QTBUG-19525 Reviewed-by: Andy Shaw --- src/gui/painting/qpainter.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index dfb9a04..a4ab00a 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -2788,6 +2788,9 @@ void QPainter::setClipRect(const QRect &rect, Qt::ClipOperation op) return; } + if (d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip) + op = Qt::ReplaceClip; + d->state->clipRegion = rect; d->state->clipOperation = op; if (op == Qt::NoClip || op == Qt::ReplaceClip) @@ -2843,6 +2846,9 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op) return; } + if (d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip) + op = Qt::ReplaceClip; + d->state->clipRegion = r; d->state->clipOperation = op; if (op == Qt::NoClip || op == Qt::ReplaceClip) @@ -3248,6 +3254,9 @@ void QPainter::setClipPath(const QPainterPath &path, Qt::ClipOperation op) return; } + if (d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip) + op = Qt::ReplaceClip; + d->state->clipPath = path; d->state->clipOperation = op; if (op == Qt::NoClip || op == Qt::ReplaceClip) -- cgit v0.12 From 48ff7e5af99923396243940979d15d4ec2e2730c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 30 May 2011 11:39:18 +0200 Subject: Missing glyphs transforming QStaticText on X11/raster with subpixel AA Static text took an untested and broken code path for the combo of subpixel AA, X11, raster engine and transformation. This would cause missing glyphs. The reason was that QStaticText took an unused code path which turned out not to work. The workaround is to use gray AA on transformed text, like we already do for the GL engine. In Qt 4.8, the static text code path has been rewritten to use the Freetype cache instead of the image glyph cache, so the bug will be fixed more properly there. Reviewed-by: Samuel --- src/gui/painting/qpaintengine_raster.cpp | 10 +++++++++- src/gui/painting/qtextureglyphcache.cpp | 8 ++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 01b22da..cd9206c 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3105,7 +3105,15 @@ void QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); - QFontEngineGlyphCache::Type glyphType = fontEngine->glyphFormat >= 0 ? QFontEngineGlyphCache::Type(fontEngine->glyphFormat) : d->glyphCacheType; + QFontEngineGlyphCache::Type glyphType; + if (fontEngine->glyphFormat >= 0) { + glyphType = QFontEngineGlyphCache::Type(fontEngine->glyphFormat); + } else if (s->matrix.type() > QTransform::TxTranslate + && d->glyphCacheType == QFontEngineGlyphCache::Raster_RGBMask) { + glyphType = QFontEngineGlyphCache::Raster_A8; + } else { + glyphType = d->glyphCacheType; + } QImageTextureGlyphCache *cache = static_cast(fontEngine->glyphCache(0, glyphType, s->matrix)); diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 16df6c1..2c1da24 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -178,14 +178,10 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const QImage QTextureGlyphCache::textureMapForGlyph(glyph_t g) const { #if defined(Q_WS_X11) - if (m_transform.type() > QTransform::TxTranslate && m_current_fontengine->type() == QFontEngine::Freetype) { + if (m_type != Raster_RGBMask && m_transform.type() > QTransform::TxTranslate && m_current_fontengine->type() == QFontEngine::Freetype) { QFontEngineFT::GlyphFormat format = QFontEngineFT::Format_None; QImage::Format imageFormat = QImage::Format_Invalid; switch (m_type) { - case Raster_RGBMask: - format = QFontEngineFT::Format_A32; - imageFormat = QImage::Format_RGB32; - break; case Raster_A8: format = QFontEngineFT::Format_A8; imageFormat = QImage::Format_Indexed8; @@ -266,7 +262,7 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g) } #endif - if (m_type == QFontEngineGlyphCache::Raster_RGBMask) { + if (m_type == QFontEngineGlyphCache::Raster_RGBMask) { QImage ref(m_image.bits() + (c.x * 4 + c.y * m_image.bytesPerLine()), qMax(mask.width(), c.w), qMax(mask.height(), c.h), m_image.bytesPerLine(), m_image.format()); -- cgit v0.12 From e159f97f6ecefb49d50a82b1084fd1b1b9e5e2cf Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 31 May 2011 11:29:46 +0200 Subject: Fix glyph metrics with QStaticText/Freetype/raster and light/no hinting This is a back-port of part of cad70d64d0bbada. In the raster engine's drawCachedGlyphs(), which is used by QStaticText, we would use the wrong metrics to lay out the glyphs, because loadGlyphMetrics() would assume full hinting. A visible effect of this was that the baseline of rotated text became wavy. Task-number: QTBUG-18185 Reviewed-by: Jiang Jiang --- src/gui/text/qfontengine_ft.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index c4e89d5..1056aed 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -762,9 +762,18 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyphMetrics(QGlyphSet *set, uint glyph return g; int load_flags = FT_LOAD_DEFAULT | default_load_flags; + int load_target = default_hint_style == HintLight + ? FT_LOAD_TARGET_LIGHT + : FT_LOAD_TARGET_NORMAL; + if (set->outline_drawing) load_flags = FT_LOAD_NO_BITMAP; + if (default_hint_style == HintNone) + load_flags |= FT_LOAD_NO_HINTING; + else + load_flags |= load_target; + // apply our matrix to this, but note that the metrics will not be affected by this. FT_Face face = lockFace(); FT_Matrix matrix = this->matrix; -- cgit v0.12 From 348894a550510e54e7709d18676b4b10c9e5e9e3 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Tue, 31 May 2011 12:15:55 +0200 Subject: Avoid buffer overrun in QMacPixmapData resizing Shouldn't use size bigger than the original (source) pixels buffer or the new one (just allocated). Task-number: QTBUG-18547 Reviewed-by: aavit --- src/gui/image/qpixmap_mac.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp index aac159e..6872cfa 100644 --- a/src/gui/image/qpixmap_mac.cpp +++ b/src/gui/image/qpixmap_mac.cpp @@ -637,7 +637,7 @@ void QMacPixmapData::macCreatePixels() } if (pixels) - memcpy(base_pixels, pixels, pixelsSize); + memcpy(base_pixels, pixels, qMin(pixelsSize, (uint) numBytes)); pixels = base_pixels; pixelsSize = numBytes; } -- cgit v0.12 From 887b19ce9313d09eb996e765c18fa19a09a5cf95 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Wed, 1 Jun 2011 16:15:13 +0300 Subject: Fix QTreeWidget autotest cases on Symbian/VGA Make two autotest cases pass on Symbian/VGA devices. Task-number: QT-5057 Reviewed-by: Miikka Heikkinen --- tests/auto/qtreewidget/tst_qtreewidget.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp index dc878c4..7d2cdfb 100644 --- a/tests/auto/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp @@ -50,6 +50,8 @@ #include #include #include +#include +#include #include "../../shared/util.h" @@ -3102,10 +3104,21 @@ void tst_QTreeWidget::task206367_duplication() QWidget topLevel; QTreeWidget treeWidget(&topLevel); topLevel.show(); +#ifndef Q_WS_S60 treeWidget.resize(200, 200); +#endif treeWidget.setSortingEnabled(true); QTreeWidgetItem* rootItem = new QTreeWidgetItem( &treeWidget, QStringList("root") ); +#ifdef Q_WS_S60 + // Ensure that eight items fit into tree widget. In Symbian VGA devices 8 rows of + // data will take more than 200 pixels. + int calculatedHeight = treeWidget.visualItemRect(treeWidget.topLevelItem(0)).height() + + 2 * QApplication::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, 0); + calculatedHeight *= 8; // eight 'rows': header, root and 2 items with 2 children + treeWidget.resize(200, qMax(200, calculatedHeight)); +#endif + for (int nFile = 0; nFile < 2; nFile++ ) { QTreeWidgetItem* itemFile = new QTreeWidgetItem(rootItem, QStringList(QString::number(nFile))); for (int nRecord = 0; nRecord < 2; nRecord++) @@ -3211,6 +3224,13 @@ void tst_QTreeWidget::task239150_editorWidth() { //we check that an item with no text will get an editor with a correct size QTreeWidget tree; +#ifdef Q_OS_SYMBIAN + //By default widgets are 640*360 in Symbian. Call to create_sys() sets the real size of the widget. + //Therefore, with VGA Symbian devices, we need to update the widget width to match screen width. + //As VGA devices have larger font, longer texts wouldn't otherwise fit into tree widget. + if (QApplication::desktop() && QApplication::desktop()->availableGeometry().width() > tree.width()) + tree.resize(QApplication::desktop()->availableGeometry().size()); +#endif QStyleOptionFrameV2 opt; opt.init(&tree); -- cgit v0.12 From 5b1a0a5564a69331d581bcf4f94da0e11d14a31f Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 2 Jun 2011 11:07:21 +1000 Subject: Add private method for flushing the pixmap cache. Change-Id: I7330383b89a3a313dd845274d17d38c714db20ce Reviewed-by: Martin Jones --- src/declarative/util/qdeclarativepixmapcache.cpp | 14 ++++++++++++++ src/declarative/util/qdeclarativepixmapcache_p.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index a29854f..831aa75 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -584,6 +584,7 @@ public: void unreferencePixmap(QDeclarativePixmapData *); void referencePixmap(QDeclarativePixmapData *); + void flushCache(); protected: virtual void timerEvent(QTimerEvent *); @@ -682,6 +683,14 @@ void QDeclarativePixmapStore::timerEvent(QTimerEvent *) } } +/* + Remove all unreferenced pixmaps from the cache. +*/ +void QDeclarativePixmapStore::flushCache() +{ + shrinkCache(m_unreferencedCost); +} + QDeclarativePixmapReply::QDeclarativePixmapReply(QDeclarativePixmapData *d) : data(d), reader(0), requestSize(d->requestSize), loading(false), redirectCount(0) { @@ -1075,6 +1084,11 @@ bool QDeclarativePixmap::connectDownloadProgress(QObject *object, int method) return QMetaObject::connect(d->reply, QDeclarativePixmapReply::downloadProgressIndex, object, method); } +void QDeclarativePixmap::flushCache() +{ + pixmapStore()->flushCache(); +} + QT_END_NAMESPACE #include diff --git a/src/declarative/util/qdeclarativepixmapcache_p.h b/src/declarative/util/qdeclarativepixmapcache_p.h index 1cf76dd..48c9f8b 100644 --- a/src/declarative/util/qdeclarativepixmapcache_p.h +++ b/src/declarative/util/qdeclarativepixmapcache_p.h @@ -103,6 +103,8 @@ public: bool connectDownloadProgress(QObject *, const char *); bool connectDownloadProgress(QObject *, int); + static void flushCache(); + private: Q_DISABLE_COPY(QDeclarativePixmap) QDeclarativePixmapData *d; -- cgit v0.12 From 8b80ff8b127c2ef5a52267bd778f44b2b2c20215 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Thu, 2 Jun 2011 11:15:33 +0300 Subject: Fix for winscw QtGui.def Reviewed-by: TRUSTME --- src/s60installs/bwins/QtGuiu.def | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 3e848ec..ca4af4a 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -13104,11 +13104,11 @@ EXPORTS ??_EQTextEngine@@QAE@I@Z @ 13103 NONAME ABSENT ; QTextEngine::~QTextEngine(unsigned int) ??4QStyleOptionTitleBar@@QAEAAV0@ABV0@@Z @ 13104 NONAME ABSENT ; class QStyleOptionTitleBar & QStyleOptionTitleBar::operator=(class QStyleOptionTitleBar const &) ??4Value@QCss@@QAEAAU01@ABU01@@Z @ 13105 NONAME ABSENT ; struct QCss::Value & QCss::Value::operator=(struct QCss::Value const &) - ?hasBCM2727@QSymbianGraphicsSystemEx@@UAE_NXZ @ 13106 NONAME ; bool QSymbianGraphicsSystemEx::hasBCM2727(void) - ??0QDragLeaveEvent@@QAE@ABV0@@Z @ 13107 NONAME ABSENT ; QDragLeaveEvent::QDragLeaveEvent(class QDragLeaveEvent const &) - ??4QBitmap@@QAEAAV0@ABV0@@Z @ 13108 NONAME ABSENT ; class QBitmap & QBitmap::operator=(class QBitmap const &) - ??0QItemSelection@@QAE@ABV0@@Z @ 13109 NONAME ABSENT ; QItemSelection::QItemSelection(class QItemSelection const &) - ??4QTextFrameFormat@@QAEAAV0@ABV0@@Z @ 13110 NONAME ABSENT ; class QTextFrameFormat & QTextFrameFormat::operator=(class QTextFrameFormat const &) - ?setInstantInvalidatePropagation@QGraphicsLayout@@SAX_N@Z @ 13111 NONAME ; void QGraphicsLayout::setInstantInvalidatePropagation(bool) - ?instantInvalidatePropagation@QGraphicsLayout@@SA_NXZ @ 13112 NONAME ; bool QGraphicsLayout::instantInvalidatePropagation(void) + ??0QDragLeaveEvent@@QAE@ABV0@@Z @ 13106 NONAME ABSENT ; QDragLeaveEvent::QDragLeaveEvent(class QDragLeaveEvent const &) + ??4QBitmap@@QAEAAV0@ABV0@@Z @ 13107 NONAME ABSENT ; class QBitmap & QBitmap::operator=(class QBitmap const &) + ??0QItemSelection@@QAE@ABV0@@Z @ 13108 NONAME ABSENT ; QItemSelection::QItemSelection(class QItemSelection const &) + ??4QTextFrameFormat@@QAEAAV0@ABV0@@Z @ 13109 NONAME ABSENT ; class QTextFrameFormat & QTextFrameFormat::operator=(class QTextFrameFormat const &) + ?setInstantInvalidatePropagation@QGraphicsLayout@@SAX_N@Z @ 13110 NONAME ; void QGraphicsLayout::setInstantInvalidatePropagation(bool) + ?instantInvalidatePropagation@QGraphicsLayout@@SA_NXZ @ 13111 NONAME ; bool QGraphicsLayout::instantInvalidatePropagation(void) + ?hasBCM2727@QSymbianGraphicsSystemEx@@SA_NXZ @ 13112 NONAME ; bool QSymbianGraphicsSystemEx::hasBCM2727(void) -- cgit v0.12 From de48af046a093834b8178238a2afb2efc8636efd Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 3 Jun 2011 11:19:44 +1000 Subject: Revert some of "Make QMLViewer startup animation stop after a while" This reverts most of commit c6e6a35aeb8794d68a3ca0c4e27a3a1181c066b5. Only the startup.qml changes were meant to go in. The other stuff is an experimental feature that was not supposed to be merged in. Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativemousearea.cpp | 16 ---------------- src/declarative/graphicsitems/qdeclarativemousearea_p.h | 3 --- .../graphicsitems/qdeclarativemousearea_p_p.h | 17 ----------------- 3 files changed, 36 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 6633256..ea04c19 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -496,9 +496,6 @@ void QDeclarativeMouseArea::mousePressEvent(QGraphicsSceneMouseEvent *event) d->pressAndHoldTimer.start(PressAndHoldDelay, this); setKeepMouseGrab(d->stealMouse); event->setAccepted(setPressed(true)); - - if(!event->isAccepted() && d->forwardToList.count()) - d->forwardEvent(event); } } @@ -576,9 +573,6 @@ void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event) me.setX(d->lastPos.x()); me.setY(d->lastPos.y()); emit positionChanged(&me); - - if(!event->isAccepted() && d->forwardToList.count()) - d->forwardEvent(event); } @@ -600,9 +594,6 @@ void QDeclarativeMouseArea::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) if (s && s->mouseGrabberItem() == this) ungrabMouse(); setKeepMouseGrab(false); - - if(!event->isAccepted() && d->forwardToList.count()) - d->forwardEvent(event); } d->doubleClick = false; } @@ -994,11 +985,4 @@ QDeclarativeDrag *QDeclarativeMouseArea::drag() */ -QDeclarativeListProperty QDeclarativeMouseArea::forwardTo() -{ - Q_D(QDeclarativeMouseArea); - return d->forwardTo; -} - - QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p.h index 0fe8c6a..b0dbc30 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea_p.h +++ b/src/declarative/graphicsitems/qdeclarativemousearea_p.h @@ -130,7 +130,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeMouseArea : public QDeclarativeItem Q_PROPERTY(bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged) Q_PROPERTY(QDeclarativeDrag *drag READ drag CONSTANT) //### add flicking to QDeclarativeDrag or add a QDeclarativeFlick ??? Q_PROPERTY(bool preventStealing READ preventStealing WRITE setPreventStealing NOTIFY preventStealingChanged REVISION 1) - Q_PROPERTY(QDeclarativeListProperty forwardTo READ forwardTo); public: QDeclarativeMouseArea(QDeclarativeItem *parent=0); @@ -158,8 +157,6 @@ public: bool preventStealing() const; void setPreventStealing(bool prevent); - QDeclarativeListProperty forwardTo(); - Q_SIGNALS: void hoveredChanged(); void pressedChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h index 7248c92..67694fb 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h @@ -70,8 +70,6 @@ public: : absorb(true), hovered(false), pressed(false), longPress(false), moved(false), stealMouse(false), doubleClick(false), preventStealing(false), drag(0) { - Q_Q(QDeclarativeMouseArea); - forwardTo = QDeclarativeListProperty(q, forwardToList); } ~QDeclarativeMouseAreaPrivate(); @@ -91,18 +89,6 @@ public: lastModifiers = event->modifiers(); } - void forwardEvent(QGraphicsSceneMouseEvent* event) - { - Q_Q(QDeclarativeMouseArea); - for(int i=0; i < forwardToList.count(); i++){ - event->setPos(forwardToList[i]->mapFromScene(event->scenePos())); - forwardToList[i]->scene()->sendEvent(forwardToList[i], event); - if(event->isAccepted()) - break; - } - event->setPos(q->mapFromScene(event->scenePos())); - } - bool isPressAndHoldConnected() { Q_Q(QDeclarativeMouseArea); static int idx = QObjectPrivate::get(q)->signalIndex("pressAndHold(QDeclarativeMouseEvent*)"); @@ -135,9 +121,6 @@ public: Qt::MouseButtons lastButtons; Qt::KeyboardModifiers lastModifiers; QBasicTimer pressAndHoldTimer; - - QDeclarativeListProperty forwardTo; - QList forwardToList; }; QT_END_NAMESPACE -- cgit v0.12