From 9a63863d6f0c614c041c3d4b375bf88d93148ef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 6 Dec 2010 14:06:56 +0100 Subject: Make sure to do a deep copy of a QImage when it's being painted on. Not doing so can produce some hard-to-track-down bugs in the app. Task-number: QTBUG-15749 Reviewed-by: Gunnar Sletta --- src/gui/image/qimage.cpp | 25 +++++++++++++++++-------- src/gui/image/qpixmap_raster.cpp | 8 ++++++++ tests/auto/qimage/tst_qimage.cpp | 16 ++++++++++++++++ tests/auto/qpixmap/tst_qpixmap.cpp | 17 +++++++++++++++++ 4 files changed, 58 insertions(+), 8 deletions(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 1157b93..6ba3858 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -1121,9 +1121,14 @@ QImage::QImage(const char * const xpm[]) QImage::QImage(const QImage &image) : QPaintDevice() { - d = image.d; - if (d) - d->ref.ref(); + if (image.paintingActive()) { + d = 0; + operator=(image.copy()); + } else { + d = image.d; + if (d) + d->ref.ref(); + } } #ifdef QT3_SUPPORT @@ -1320,11 +1325,15 @@ QImage::~QImage() QImage &QImage::operator=(const QImage &image) { - if (image.d) - image.d->ref.ref(); - if (d && !d->ref.deref()) - delete d; - d = image.d; + if (image.paintingActive()) { + operator=(image.copy()); + } else { + if (image.d) + image.d->ref.ref(); + if (d && !d->ref.deref()) + delete d; + d = image.d; + } return *this; } diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index 53f3559..f080687 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -44,6 +44,7 @@ #include "qpixmap_raster_p.h" #include "qnativeimage_p.h" #include "qimage_p.h" +#include "qpaintengine.h" #include "qbitmap.h" #include "qimage.h" @@ -302,6 +303,13 @@ bool QRasterPixmapData::hasAlphaChannel() const QImage QRasterPixmapData::toImage() const { + if (image.paintEngine() + && image.paintEngine()->isActive() + && image.paintEngine()->paintDevice() == &image) + { + return image.copy(); + } + return image; } diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp index b446941..b2c59fc 100644 --- a/tests/auto/qimage/tst_qimage.cpp +++ b/tests/auto/qimage/tst_qimage.cpp @@ -142,6 +142,8 @@ private slots: void rgbSwapped_data(); void rgbSwapped(); + + void deepCopyWhenPaintingActive(); }; tst_QImage::tst_QImage() @@ -1886,5 +1888,19 @@ void tst_QImage::rgbSwapped() QCOMPARE(memcmp(image.constBits(), imageSwappedTwice.constBits(), image.numBytes()), 0); } +void tst_QImage::deepCopyWhenPaintingActive() +{ + QImage image(64, 64, QImage::Format_ARGB32_Premultiplied); + image.fill(0); + + QPainter painter(&image); + QImage copy = image; + + painter.setBrush(Qt::black); + painter.drawEllipse(image.rect()); + + QVERIFY(copy != image); +} + QTEST_MAIN(tst_QImage) #include "tst_qimage.moc" diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 51e6cf5..d5267b5 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -185,6 +185,8 @@ private slots: void preserveDepth(); void splash_crash(); + void toImageDeepCopy(); + void loadAsBitmapOrPixmap(); }; @@ -1751,6 +1753,21 @@ void tst_QPixmap::loadAsBitmapOrPixmap() QVERIFY(bitmap.isQBitmap()); } +void tst_QPixmap::toImageDeepCopy() +{ + QPixmap pixmap(64, 64); + pixmap.fill(Qt::white); + + QPainter painter(&pixmap); + QImage first = pixmap.toImage(); + + painter.setBrush(Qt::black); + painter.drawEllipse(pixmap.rect()); + + QImage second = pixmap.toImage(); + + QVERIFY(first != second); +} QTEST_MAIN(tst_QPixmap) -- cgit v0.12 From fd3fc0b34a891751e6a0849421e8cecd19481324 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Mon, 6 Dec 2010 15:55:22 +0100 Subject: Fix crash in QTextDocument::markContentsDirty 6f6c25b6 introduced this regression because it didn't check d->lout before calling d->lout->documentChange(). Task-number: QTBUG-15777 Reviewed-by: Eskil --- src/gui/text/qtextdocument.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index c35069f..77e6aa1 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -596,8 +596,10 @@ void QTextDocument::markContentsDirty(int from, int length) Q_D(QTextDocument); d->documentChange(from, length); if (!d->inContentsChange) { - d->lout->documentChanged(d->docChangeFrom, d->docChangeOldLength, d->docChangeLength); - d->docChangeFrom = -1; + if (d->lout) { + d->lout->documentChanged(d->docChangeFrom, d->docChangeOldLength, d->docChangeLength); + d->docChangeFrom = -1; + } } } -- cgit v0.12 From 8f7de974b34b6fc6c0c15dbf4cdc35e5722e2196 Mon Sep 17 00:00:00 2001 From: Ruben Van Boxem Date: Tue, 7 Dec 2010 12:29:36 +0100 Subject: Fix for GCC on Windows x64. Merge-request: 939 Reviewed-by: Olivier Goffart --- src/corelib/tools/qsimd.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index 63ebafb..bc5e9e4 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -285,7 +285,13 @@ static inline uint detectProcessorFeatures() uint features = MMX|SSE|SSE2|CMOV; uint feature_result = 0; -#if defined(Q_CC_GNU) +#if defined (Q_OS_WIN64) + { + int info[4]; + __cpuid(info, 1); + feature_result = info[2]; + } +#elif defined(Q_CC_GNU) quint64 tmp; asm ("xchg %%rbx, %1\n" "cpuid\n" @@ -294,12 +300,6 @@ static inline uint detectProcessorFeatures() : "a" (1) : "%edx" ); -#elif defined (Q_OS_WIN64) - { - int info[4]; - __cpuid(info, 1); - feature_result = info[2]; - } #endif if (feature_result & (1u)) -- cgit v0.12 From 532115bcaa370af827a5cbad017b272842c5aacf Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 7 Dec 2010 13:02:48 +0100 Subject: Fix text disappearing on GL when RGB-path is taken (no transformation) When there is no transformation on a glyph in the GL texture glyph cache, it will take the RGB code path to support subpixel antialiasing. In this code path we would ask glTextImage2D() to convert from a GL_ALPHA buffer to an internal format of GL_RGBA. This is not supported on OpenGL ES 2, and would cause missing text for some drivers. The change also fixes a typo in an #ifdef. Task-number: QTBUG-15789 Reviewed-by: Kim --- src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 705ad09..66445cd 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -128,14 +128,17 @@ void QGLTextureGlyphCache::createTextureData(int width, int height) m_width = width; m_height = height; - QVarLengthArray data(width * height); - for (int i = 0; i < data.size(); ++i) - data[i] = 0; - - if (m_type == QFontEngineGlyphCache::Raster_RGBMask) - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]); - else + if (m_type == QFontEngineGlyphCache::Raster_RGBMask) { + QVarLengthArray data(width * height * 4); + for (int i = 0; i < data.size(); ++i) + data[i] = 0; + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]); + } else { + QVarLengthArray data(width * height); + for (int i = 0; i < data.size(); ++i) + data[i] = 0; glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]); + } glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); @@ -287,7 +290,7 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph) if (mask.format() == QImage::Format_RGB32) { glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_BGRA, GL_UNSIGNED_BYTE, mask.bits()); } else { -#ifdef QT_OPENGL_ES2 +#ifdef QT_OPENGL_ES_2 glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_ALPHA, GL_UNSIGNED_BYTE, mask.bits()); #else // glTexSubImage2D() might cause some garbage to appear in the texture if the mask width is -- cgit v0.12 From eac9e6a11e7727d8a749242f317362337ce89a1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 7 Dec 2010 12:53:37 +0100 Subject: Prevent always deep-copying in QPixmap::toImage() for raster pixmaps. Calling paintEngine() can cause a deep copy since it will indirectly call the bits() function. Since we don't want to create a paint engine if it doesn't exist we should access the QImageData paintEngine variable directly instead. Reviewed-by: Olivier Goffart --- src/gui/image/qpixmap_raster.cpp | 13 ++++++++----- tests/auto/qpixmap/tst_qpixmap.cpp | 10 ++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index f080687..29bf5f5 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -50,6 +50,7 @@ #include "qimage.h" #include #include +#include #include #include #include @@ -303,11 +304,13 @@ bool QRasterPixmapData::hasAlphaChannel() const QImage QRasterPixmapData::toImage() const { - if (image.paintEngine() - && image.paintEngine()->isActive() - && image.paintEngine()->paintDevice() == &image) - { - return image.copy(); + if (!image.isNull()) { + QImageData *data = const_cast(image).data_ptr(); + if (data->paintEngine && data->paintEngine->isActive() + && data->paintEngine->paintDevice() == &image) + { + return image.copy(); + } } return image; diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index d5267b5..419518a1 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -129,10 +129,7 @@ private slots: void isNull(); void task_246446(); -#ifdef Q_WS_QWS void convertFromImageNoDetach(); -#endif - void convertFromImageDetach(); #if defined(Q_WS_WIN) @@ -913,11 +910,13 @@ void tst_QPixmap::isNull() } } -#ifdef Q_WS_QWS void tst_QPixmap::convertFromImageNoDetach() { + QPixmap randomPixmap(10, 10); + if (randomPixmap.pixmapData()->classId() != QPixmapData::RasterClass) + QSKIP("Test only valid for raster pixmaps", SkipAll); + //first get the screen format - QPixmap randomPixmap(10,10); QImage::Format screenFormat = randomPixmap.toImage().format(); QVERIFY(screenFormat != QImage::Format_Invalid); @@ -932,7 +931,6 @@ void tst_QPixmap::convertFromImageNoDetach() const QImage constCopy = copy; QVERIFY(constOrig.bits() == constCopy.bits()); } -#endif //Q_WS_QWS void tst_QPixmap::convertFromImageDetach() { -- cgit v0.12 From 783a278f243c6411f5f32d11f2165b9eed9b6f8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 7 Dec 2010 14:27:14 +0100 Subject: Don't emit activeFocusChanged() unless the active focus actually changed We would previously call subFocusItemChanged(0) on the item as part of clearing the subfocus, even if the item in question would recieve a new subfocus item as part of setting the new subfocus. This resulted in the declarative item emitting activeFocusChanged(false) and then activeFocusChanged(true), which was affecting any animation or state bound to the activeFocus property of the item. We now stop clearing the subfocus when encountering an item that we know will get subfocus during the set-subfocus pass. We then set subfocus all the way to the root item, since the subfocus item itself might change. The effect of this is that the declarative item will only get one call to subFocusItemChanged(), passing the new subfocus item, instead of two. This means the declarative item can keep track of wherther ot not it had a subfocus item previously, and only emit activeFocusChanged() when the active focus goes from true to false or false to true. Task-number: QTBUG-15615 Reviewed-by: Yoann Lopes --- src/declarative/graphicsitems/qdeclarativeitem_p.h | 10 +- src/gui/graphicsview/qgraphicsitem.cpp | 18 ++-- src/gui/graphicsview/qgraphicsitem_p.h | 4 +- .../data/forceActiveFocus.qml | 26 +++++ .../tst_qdeclarativefocusscope.cpp | 109 +++++++++++++++++++++ 5 files changed, 155 insertions(+), 12 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativefocusscope/data/forceActiveFocus.qml diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h index d8635b9..a36ee34 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem_p.h +++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h @@ -126,7 +126,7 @@ public: widthValid(false), heightValid(false), componentComplete(true), keepMouse(false), smooth(false), transformOriginDirty(true), doneEventPreHandler(false), keyHandler(0), - mWidth(0), mHeight(0), implicitWidth(0), implicitHeight(0) + mWidth(0), mHeight(0), implicitWidth(0), implicitHeight(0), hadSubFocusItem(false) { QGraphicsItemPrivate::acceptedMouseButtons = 0; isDeclarativeItem = 1; @@ -275,6 +275,8 @@ public: qreal implicitWidth; qreal implicitHeight; + bool hadSubFocusItem; + QPointF computeTransformOrigin() const; virtual void setPosHelper(const QPointF &pos) @@ -288,9 +290,11 @@ public: // Reimplemented from QGraphicsItemPrivate virtual void subFocusItemChange() { - if (flags & QGraphicsItem::ItemIsFocusScope || !parent) - emit q_func()->activeFocusChanged(subFocusItem != 0); + bool hasSubFocusItem = subFocusItem != 0; + if (((flags & QGraphicsItem::ItemIsFocusScope) || !parent) && hasSubFocusItem != hadSubFocusItem) + emit q_func()->activeFocusChanged(hasSubFocusItem); //see also QDeclarativeItemPrivate::focusChanged + hadSubFocusItem = hasSubFocusItem; } // Reimplemented from QGraphicsItemPrivate diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 7ab49cb..94e1a72 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -3295,9 +3295,13 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim } // Update the child focus chain. - if (scene && scene->focusItem()) - scene->focusItem()->d_ptr->clearSubFocus(); - f->d_ptr->setSubFocus(); + QGraphicsItem *commonAncestor = 0; + if (scene && scene->focusItem()) { + commonAncestor = scene->focusItem()->commonAncestorItem(f); + scene->focusItem()->d_ptr->clearSubFocus(scene->focusItem(), commonAncestor); + } + + f->d_ptr->setSubFocus(f, commonAncestor); // Update the scene's focus item. if (scene) { @@ -5554,7 +5558,7 @@ void QGraphicsItemPrivate::ensureSceneTransformRecursive(QGraphicsItem **topMost /*! \internal */ -void QGraphicsItemPrivate::setSubFocus(QGraphicsItem *rootItem) +void QGraphicsItemPrivate::setSubFocus(QGraphicsItem *rootItem, QGraphicsItem *stopItem) { // Update focus child chain. Stop at panels, or if this item // is hidden, stop at the first item with a visible parent. @@ -5567,7 +5571,7 @@ void QGraphicsItemPrivate::setSubFocus(QGraphicsItem *rootItem) if (parent != q_ptr && parent->d_ptr->subFocusItem) { if (parent->d_ptr->subFocusItem == q_ptr) break; - parent->d_ptr->subFocusItem->d_ptr->clearSubFocus(); + parent->d_ptr->subFocusItem->d_ptr->clearSubFocus(0, stopItem); } parent->d_ptr->subFocusItem = q_ptr; parent->d_ptr->subFocusItemChange(); @@ -5580,12 +5584,12 @@ void QGraphicsItemPrivate::setSubFocus(QGraphicsItem *rootItem) /*! \internal */ -void QGraphicsItemPrivate::clearSubFocus(QGraphicsItem *rootItem) +void QGraphicsItemPrivate::clearSubFocus(QGraphicsItem *rootItem, QGraphicsItem *stopItem) { // Reset sub focus chain. QGraphicsItem *parent = rootItem ? rootItem : q_ptr; do { - if (parent->d_ptr->subFocusItem != q_ptr) + if (parent->d_ptr->subFocusItem != q_ptr || parent == stopItem) break; parent->d_ptr->subFocusItem = 0; parent->d_ptr->subFocusItemChange(); diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 1b7aa97..b938759 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -479,8 +479,8 @@ public: void setFocusHelper(Qt::FocusReason focusReason, bool climb, bool focusFromHide); void clearFocusHelper(bool giveFocusToParent); - void setSubFocus(QGraphicsItem *rootItem = 0); - void clearSubFocus(QGraphicsItem *rootItem = 0); + void setSubFocus(QGraphicsItem *rootItem = 0, QGraphicsItem *stopItem = 0); + void clearSubFocus(QGraphicsItem *rootItem = 0, QGraphicsItem *stopItem = 0); void resetFocusProxy(); virtual void subFocusItemChange(); virtual void focusScopeItemChange(bool isSubFocusItem); diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/forceActiveFocus.qml b/tests/auto/declarative/qdeclarativefocusscope/data/forceActiveFocus.qml new file mode 100644 index 0000000..6c39d4a --- /dev/null +++ b/tests/auto/declarative/qdeclarativefocusscope/data/forceActiveFocus.qml @@ -0,0 +1,26 @@ +import QtQuick 1.0 + +Rectangle { + objectName: "root" + FocusScope { + objectName: "scope" + Item { + objectName: "item-a1" + FocusScope { + objectName: "scope-a" + Item { + objectName: "item-a2" + } + } + } + Item { + objectName: "item-b1" + FocusScope { + objectName: "scope-b" + Item { + objectName: "item-b2" + } + } + } + } +} diff --git a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp index 1645dac..6a3627b 100644 --- a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp +++ b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp @@ -71,6 +71,7 @@ private slots: void noParentFocus(); void signalEmission(); void qtBug13380(); + void forceActiveFocus(); }; /* @@ -432,6 +433,114 @@ void tst_qdeclarativefocusscope::qtBug13380() delete view; } +void tst_qdeclarativefocusscope::forceActiveFocus() +{ + QDeclarativeView *view = new QDeclarativeView; + view->setSource(QUrl::fromLocalFile(SRCDIR "/data/forceActiveFocus.qml")); + + QGraphicsObject *rootObject = view->rootObject(); + QVERIFY(rootObject); + + QDeclarativeItem *scope = findItem(rootObject, QLatin1String("scope")); + QDeclarativeItem *itemA1 = findItem(rootObject, QLatin1String("item-a1")); + QDeclarativeItem *scopeA = findItem(rootObject, QLatin1String("scope-a")); + QDeclarativeItem *itemA2 = findItem(rootObject, QLatin1String("item-a2")); + QDeclarativeItem *itemB1 = findItem(rootObject, QLatin1String("item-b1")); + QDeclarativeItem *scopeB = findItem(rootObject, QLatin1String("scope-b")); + QDeclarativeItem *itemB2 = findItem(rootObject, QLatin1String("item-b2")); + + QVERIFY(scope); + QVERIFY(itemA1); + QVERIFY(scopeA); + QVERIFY(itemA2); + QVERIFY(itemB1); + QVERIFY(scopeB); + QVERIFY(itemB2); + + QSignalSpy rootSpy(rootObject, SIGNAL(activeFocusChanged(bool))); + QSignalSpy scopeSpy(scope, SIGNAL(activeFocusChanged(bool))); + QSignalSpy scopeASpy(scopeA, SIGNAL(activeFocusChanged(bool))); + QSignalSpy scopeBSpy(scopeB, SIGNAL(activeFocusChanged(bool))); + + // First, walk the focus from item-a1 down to item-a2 and back again + itemA1->forceActiveFocus(); + QVERIFY(itemA1->hasActiveFocus()); + QCOMPARE(rootSpy.count(), 1); + QCOMPARE(scopeSpy.count(), 1); + + scopeA->forceActiveFocus(); + QVERIFY(!itemA1->hasActiveFocus()); + QVERIFY(scopeA->hasActiveFocus()); + QCOMPARE(scopeASpy.count(), 1); + QCOMPARE(rootSpy.count(), 1); + QCOMPARE(scopeSpy.count(), 1); + + itemA2->forceActiveFocus(); + QVERIFY(!itemA1->hasActiveFocus()); + QVERIFY(itemA2->hasActiveFocus()); + QVERIFY(scopeA->hasActiveFocus()); + QCOMPARE(scopeASpy.count(), 1); + QCOMPARE(rootSpy.count(), 1); + QCOMPARE(scopeSpy.count(), 1); + + scopeA->forceActiveFocus(); + QVERIFY(!itemA1->hasActiveFocus()); + QVERIFY(itemA2->hasActiveFocus()); + QVERIFY(scopeA->hasActiveFocus()); + QCOMPARE(scopeASpy.count(), 1); + QCOMPARE(rootSpy.count(), 1); + QCOMPARE(scopeSpy.count(), 1); + + itemA1->forceActiveFocus(); + QVERIFY(itemA1->hasActiveFocus()); + QVERIFY(!scopeA->hasActiveFocus()); + QVERIFY(!itemA2->hasActiveFocus()); + QCOMPARE(scopeASpy.count(), 2); + QCOMPARE(rootSpy.count(), 1); + QCOMPARE(scopeSpy.count(), 1); + + // Then jump back and forth between branch 'a' and 'b' + itemB1->forceActiveFocus(); + QVERIFY(itemB1->hasActiveFocus()); + QCOMPARE(rootSpy.count(), 1); + QCOMPARE(scopeSpy.count(), 1); + + scopeA->forceActiveFocus(); + QVERIFY(!itemA1->hasActiveFocus()); + QVERIFY(!itemB1->hasActiveFocus()); + QVERIFY(scopeA->hasActiveFocus()); + QCOMPARE(scopeASpy.count(), 3); + QCOMPARE(rootSpy.count(), 1); + QCOMPARE(scopeSpy.count(), 1); + + scopeB->forceActiveFocus(); + QVERIFY(!scopeA->hasActiveFocus()); + QVERIFY(!itemB1->hasActiveFocus()); + QVERIFY(scopeB->hasActiveFocus()); + QCOMPARE(scopeASpy.count(), 4); + QCOMPARE(scopeBSpy.count(), 1); + QCOMPARE(rootSpy.count(), 1); + QCOMPARE(scopeSpy.count(), 1); + + itemA2->forceActiveFocus(); + QVERIFY(!scopeB->hasActiveFocus()); + QVERIFY(itemA2->hasActiveFocus()); + QCOMPARE(scopeASpy.count(), 5); + QCOMPARE(scopeBSpy.count(), 2); + QCOMPARE(rootSpy.count(), 1); + QCOMPARE(scopeSpy.count(), 1); + + itemB2->forceActiveFocus(); + QVERIFY(!itemA2->hasActiveFocus()); + QVERIFY(itemB2->hasActiveFocus()); + QCOMPARE(scopeASpy.count(), 6); + QCOMPARE(scopeBSpy.count(), 3); + QCOMPARE(rootSpy.count(), 1); + QCOMPARE(scopeSpy.count(), 1); + + delete view; +} + QTEST_MAIN(tst_qdeclarativefocusscope) #include "tst_qdeclarativefocusscope.moc" -- cgit v0.12 From 2eea05dee36f6ce263a91eae88f1029d2c333988 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 3 Dec 2010 13:39:24 +0200 Subject: Proxy mode was not correctly checked. Fixes: NB#208617 - QtProxyFactory does not return correct (any) proxy data --- src/plugins/bearer/icd/proxyconf.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/bearer/icd/proxyconf.cpp b/src/plugins/bearer/icd/proxyconf.cpp index 37501fb..efe2da7 100644 --- a/src/plugins/bearer/icd/proxyconf.cpp +++ b/src/plugins/bearer/icd/proxyconf.cpp @@ -306,12 +306,12 @@ QList ProxyConfPrivate::flush(const QNetworkProxyQuery &query) if (isHostExcluded(query.peerHostName())) return result; // no proxy for this host - if (mode == "auto") { + if (mode == QLatin1String("AUTO")) { // TODO: pac currently not supported, fix me return result; } - if (mode == "manual") { + if (mode == QLatin1String("MANUAL")) { bool isHttps = false; QString protocol = query.protocolTag().toLower(); -- cgit v0.12 From 8e01304939a19b65267887b220aa9814fc56b350 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Wed, 8 Dec 2010 10:52:36 +0100 Subject: Make sure QMeeGoGraphicsSystem::setTranslucent can't be called if surface already created. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 967 Reviewed-by: Samuel Rødal --- src/plugins/graphicssystems/meego/qmeegographicssystem.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp index 507f70b..4a86082 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp @@ -124,8 +124,10 @@ QPixmapData* QMeeGoGraphicsSystem::wrapPixmapData(QPixmapData *pmd) void QMeeGoGraphicsSystem::setSurfaceFixedSize(int /*width*/, int /*height*/) { - if (QMeeGoGraphicsSystem::surfaceWasCreated) + if (QMeeGoGraphicsSystem::surfaceWasCreated) { qWarning("Trying to set surface fixed size but surface already created!"); + return; + } #ifdef QT_WAS_PATCHED QEglProperties *properties = new QEglProperties(); @@ -143,6 +145,11 @@ void QMeeGoGraphicsSystem::setSurfaceScaling(int x, int y, int width, int height void QMeeGoGraphicsSystem::setTranslucent(bool translucent) { + if (QMeeGoGraphicsSystem::surfaceWasCreated) { + qWarning("Trying to set translucency but surface already created!"); + return; + } + QGLWindowSurface::surfaceFormat.setSampleBuffers(false); QGLWindowSurface::surfaceFormat.setSamples(0); QGLWindowSurface::surfaceFormat.setAlpha(translucent); -- cgit v0.12 From d5383440d1a3e0d96cfcfa754aaefe9d30f2e022 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Wed, 8 Dec 2010 10:46:16 +0100 Subject: Fix QWingedEdge memory usage issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QWingedEdge should reserve the amount of segments/edges/vertices in relative to the element count instead of length of the QPainterPath passed in. This problem is especially severe when QTextLayout using it to calculate the region for full line selection highlighting, because the region used QFIXED_MAX as right most coordinate, it will cost more than 2 GB of memory allocated just for it (recorded by valgrind on Mac OS X), and cause crash in systems short of memory. Task-number: QTBUG-15823 Reviewed-by: Samuel Rødal --- src/gui/painting/qpathclipper.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index a17b7c1..5060ad6 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -868,9 +868,9 @@ QWingedEdge::QWingedEdge() : } QWingedEdge::QWingedEdge(const QPainterPath &subject, const QPainterPath &clip) : - m_edges(subject.length()), - m_vertices(subject.length()), - m_segments(subject.length()) + m_edges(subject.elementCount()), + m_vertices(subject.elementCount()), + m_segments(subject.elementCount()) { m_segments.setPath(subject); m_segments.addPath(clip); @@ -1405,9 +1405,9 @@ bool QPathClipper::intersect() else if (clipIsRect) return subjectPath.intersects(r2); - QPathSegments a(subjectPath.length()); + QPathSegments a(subjectPath.elementCount()); a.setPath(subjectPath); - QPathSegments b(clipPath.length()); + QPathSegments b(clipPath.elementCount()); b.setPath(clipPath); QIntersectionFinder finder; @@ -1450,9 +1450,9 @@ bool QPathClipper::contains() if (clipIsRect) return subjectPath.contains(r2); - QPathSegments a(subjectPath.length()); + QPathSegments a(subjectPath.elementCount()); a.setPath(subjectPath); - QPathSegments b(clipPath.length()); + QPathSegments b(clipPath.elementCount()); b.setPath(clipPath); QIntersectionFinder finder; -- cgit v0.12 From 36d38c3670aca638a99618291a467b0a4b36f919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 8 Dec 2010 11:52:14 +0100 Subject: Update .def files after 783a278f243c6411f5f32d11f2165b9eed9b6f8c Based on patch from CI system --- src/s60installs/eabi/QtGuiu.def | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 54768a1..632326d 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -4658,11 +4658,11 @@ EXPORTS _ZN20QGraphicsEllipseItemD1Ev @ 4657 NONAME _ZN20QGraphicsEllipseItemD2Ev @ 4658 NONAME _ZN20QGraphicsItemPrivate11removeChildEP13QGraphicsItem @ 4659 NONAME - _ZN20QGraphicsItemPrivate11setSubFocusEP13QGraphicsItem @ 4660 NONAME + _ZN20QGraphicsItemPrivate11setSubFocusEP13QGraphicsItem @ 4660 NONAME ABSENT _ZN20QGraphicsItemPrivate12remapItemPosEP6QEventP13QGraphicsItem @ 4661 NONAME _ZN20QGraphicsItemPrivate12resolveDepthEv @ 4662 NONAME _ZN20QGraphicsItemPrivate12setPosHelperERK7QPointF @ 4663 NONAME - _ZN20QGraphicsItemPrivate13clearSubFocusEP13QGraphicsItem @ 4664 NONAME + _ZN20QGraphicsItemPrivate13clearSubFocusEP13QGraphicsItem @ 4664 NONAME ABSENT _ZN20QGraphicsItemPrivate14setFocusHelperEN2Qt11FocusReasonEb @ 4665 NONAME ABSENT _ZN20QGraphicsItemPrivate15resetFocusProxyEv @ 4666 NONAME _ZN20QGraphicsItemPrivate16setEnabledHelperEbbb @ 4667 NONAME @@ -12105,4 +12105,6 @@ EXPORTS _ZN15QStaticTextItemD1Ev @ 12104 NONAME _ZN15QStaticTextItemD2Ev @ 12105 NONAME _ZN19QEventDispatcherS6031reactivateDeferredActiveObjectsEv @ 12106 NONAME + _ZN20QGraphicsItemPrivate11setSubFocusEP13QGraphicsItemS1_ @ 12107 NONAME + _ZN20QGraphicsItemPrivate13clearSubFocusEP13QGraphicsItemS1_ @ 12108 NONAME -- cgit v0.12 From eb2bd43078c1bb43481aab795f92e105fa130860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 8 Dec 2010 12:18:06 +0100 Subject: Revert "qgrayraster: Speed up rendering of small cubic splines." This reverts commit a9c0fbd5e946ae6e90b6db6dd4aea64c824a4066. The subdivision code in the above commit messed up subdivision of cubic beziers, so we have to revert it. Task-number: QTBUG-15660 Reviewed-by: Andreas Kling --- src/gui/painting/qgrayraster.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c index ec9ebeb..5d665cd 100644 --- a/src/gui/painting/qgrayraster.c +++ b/src/gui/painting/qgrayraster.c @@ -963,49 +963,53 @@ const QT_FT_Vector* control2, const QT_FT_Vector* to ) { + TPos dx, dy, da, db; int top, level; int* levels; QT_FT_Vector* arc; - int mid_x = ( DOWNSCALE( ras.x ) + to->x + - 3 * (control1->x + control2->x ) ) / 8; - int mid_y = ( DOWNSCALE( ras.y ) + to->y + - 3 * (control1->y + control2->y ) ) / 8; - TPos dx = DOWNSCALE( ras.x ) + to->x - ( mid_x << 1 ); - TPos dy = DOWNSCALE( ras.y ) + to->y - ( mid_y << 1 ); + dx = DOWNSCALE( ras.x ) + to->x - ( control1->x << 1 ); if ( dx < 0 ) dx = -dx; + dy = DOWNSCALE( ras.y ) + to->y - ( control1->y << 1 ); if ( dy < 0 ) dy = -dy; if ( dx < dy ) dx = dy; + da = dx; + + dx = DOWNSCALE( ras.x ) + to->x - 3 * ( control1->x + control2->x ); + if ( dx < 0 ) + dx = -dx; + dy = DOWNSCALE( ras.y ) + to->y - 3 * ( control1->x + control2->y ); + if ( dy < 0 ) + dy = -dy; + if ( dx < dy ) + dx = dy; + db = dx; level = 1; - dx /= ras.cubic_level; - while ( dx > 0 ) + da = da / ras.cubic_level; + db = db / ras.conic_level; + while ( da > 0 || db > 0 ) { - dx >>= 2; + da >>= 2; + db >>= 3; level++; } if ( level <= 1 ) { - TPos to_x, to_y; + TPos to_x, to_y, mid_x, mid_y; to_x = UPSCALE( to->x ); to_y = UPSCALE( to->y ); - - /* Recalculation of midpoint is needed only if */ - /* UPSCALE and DOWNSCALE have any effect. */ - -#if ( PIXEL_BITS != 6 ) mid_x = ( ras.x + to_x + 3 * UPSCALE( control1->x + control2->x ) ) / 8; mid_y = ( ras.y + to_y + 3 * UPSCALE( control1->y + control2->y ) ) / 8; -#endif gray_render_line( RAS_VAR_ mid_x, mid_y ); gray_render_line( RAS_VAR_ to_x, to_y ); -- cgit v0.12 From 07b3a1c3d38d5870009e76de6315a9025e8f7915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 8 Dec 2010 12:28:34 +0100 Subject: Fixed cubic bezier rendering bug in qgrayraster. Use the y coordinates to compute the y delta... This could cause too fine (or too coarse) subdivision of cubic bezier curves, so potentially both performance problems and visual artifacts. Task-number: QTBUG-15660 Reviewed-by: Andreas Kling --- src/gui/painting/qgrayraster.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c index 5d665cd..001345f 100644 --- a/src/gui/painting/qgrayraster.c +++ b/src/gui/painting/qgrayraster.c @@ -982,7 +982,7 @@ dx = DOWNSCALE( ras.x ) + to->x - 3 * ( control1->x + control2->x ); if ( dx < 0 ) dx = -dx; - dy = DOWNSCALE( ras.y ) + to->y - 3 * ( control1->x + control2->y ); + dy = DOWNSCALE( ras.y ) + to->y - 3 * ( control1->y + control2->y ); if ( dy < 0 ) dy = -dy; if ( dx < dy ) -- cgit v0.12 From 299e27838df58153e76e5b3d9bee46dc2a867dec Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Wed, 8 Dec 2010 13:44:03 +0100 Subject: Use a different dither distribution matrix + a bit of rand. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also don't dither on edges. Improves dithering over tiles/scaled smooth gradients. Merge-request: 971 Reviewed-by: Samuel Rødal --- src/plugins/graphicssystems/meego/dithering.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugins/graphicssystems/meego/dithering.cpp b/src/plugins/graphicssystems/meego/dithering.cpp index 1a2e3fa..ca303a8 100644 --- a/src/plugins/graphicssystems/meego/dithering.cpp +++ b/src/plugins/graphicssystems/meego/dithering.cpp @@ -154,7 +154,10 @@ unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int h // Add the diffusion for this pixel we stored in the accumulator. // >> 7 because the values in accumulator are stored * 128 - component[c] += accumulator[c][x] >> 7; + if (x != 0 && x != (width - 1)) { + if (accumulator[c][x] >> 7 != 0) + component[c] += rand() % accumulator[c][x] >> 7; + } // Make sure we're not over the boundaries. CLAMP_256(component[c]); @@ -172,10 +175,10 @@ unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int h // Distribute the difference according to the matrix in the // accumulation bufffer. - ACCUMULATE(accumulator[c], x + 1, 0, width, diff * 7); - ACCUMULATE(accumulator[c], x - 1, 1, width, diff * 3); + ACCUMULATE(accumulator[c], x + 1, 0, width, diff * 3); + ACCUMULATE(accumulator[c], x - 1, 1, width, diff * 5); ACCUMULATE(accumulator[c], x, 1, width, diff * 5); - ACCUMULATE(accumulator[c], x + 1, 1, width, diff * 1); + ACCUMULATE(accumulator[c], x + 1, 1, width, diff * 3); } // Write the newly produced pixel -- cgit v0.12 From f317d94880554a114937554907d08807c0cf5047 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Wed, 8 Dec 2010 13:48:22 +0100 Subject: Support for 'qglTranslucent' in QGLWindowSurface. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 2523 Reviewed-by: Samuel Rødal --- src/opengl/qwindowsurface_gl.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index bbb98d0..cd9ae01 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -377,7 +377,25 @@ void QGLWindowSurface::hijackWindow(QWidget *widget) if (widgetPrivate->extraData()->glContext) return; - QGLContext *ctx = new QGLContext(surfaceFormat, widget); + QGLContext *ctx = NULL; + + // Inspect the 'qglTranslucent' property of the target widget. If set to true, + // we need to create the surface in a 32bit alpha-compatible format. This is + // currently used by MeeGo graphics system extra API's. Could be in future + // used by other platform-specific graphic system API's. + if (widget->property("qglTranslucent").isValid()) { + QGLFormat modFormat(surfaceFormat); + + if (widget->property("qglTranslucent").toBool() == true) { + modFormat.setSampleBuffers(false); + modFormat.setSamples(0); + modFormat.setAlpha(true); + } + + ctx = new QGLContext(modFormat, widget); + } else + ctx = new QGLContext(surfaceFormat, widget); + ctx->create(qt_gl_share_widget()->context()); #ifndef QT_NO_EGL -- cgit v0.12 From c4f4d801f5dd31ca4c65c70b2245c987ac8ff203 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Wed, 8 Dec 2010 13:48:23 +0100 Subject: New translucency API for the meego graphics system. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 2523 Reviewed-by: Samuel Rødal --- .../qmeegographicssystemhelper.cpp | 5 +++++ .../qmeegographicssystemhelper.h | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp index b660eb3..13e44b8 100644 --- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp @@ -153,3 +153,8 @@ void QMeeGoGraphicsSystemHelper::setTranslucent(bool translucent) ENSURE_RUNNING_MEEGO; QMeeGoRuntime::setTranslucent(translucent); } + +void QMeeGoGraphicsSystemHelper::setTranslucentWidget(QWidget w, bool translucent) +{ + w.setProperty("qglTranslucent", QVariant(translucent)); +} diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h index d47c829..3e1333d 100644 --- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h @@ -181,8 +181,25 @@ public: This function needs to be called *before* any widget/content is created. When called with true, the base window surface will be translucent and initialized with QGLFormat.alpha == true. + + This function is *deprecated*. Use ::setTranslucentWidget instead. */ static void setTranslucent(bool translucent); + + //! Sets translucency (alpha) on the given top-level widget. + /*! + This is a new API for enabling GL translucency on top-level widgets. + The specified widget needs to be top-level. When the time comes to create + a window surface for the widget, it'll be created with translucency enabled + (if translucent is true). + + This function has no effect if the widget is already visible or if it's + not a top-level widget. + + This function can be called even if not running MeeGo graphics system. It'll + have no effect though. + */ + static void setTranslucentWidget(QWidget w, bool translucent); }; #endif -- cgit v0.12 From b850c43896d60b4dda21b01fdbdb15013cca48fa Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Wed, 8 Dec 2010 15:45:00 +0100 Subject: Check Qt::WA_TranslucentBackground instead of custom widget property. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 2523 Reviewed-by: Samuel Rødal --- src/opengl/qwindowsurface_gl.cpp | 17 +++++------------ .../qmeegographicssystemhelper.cpp | 5 ----- .../qmeegographicssystemhelper.h | 18 ++---------------- 3 files changed, 7 insertions(+), 33 deletions(-) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index cd9ae01..f64b93c 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -379,19 +379,12 @@ void QGLWindowSurface::hijackWindow(QWidget *widget) QGLContext *ctx = NULL; - // Inspect the 'qglTranslucent' property of the target widget. If set to true, - // we need to create the surface in a 32bit alpha-compatible format. This is - // currently used by MeeGo graphics system extra API's. Could be in future - // used by other platform-specific graphic system API's. - if (widget->property("qglTranslucent").isValid()) { + // For translucent top-level widgets we need alpha in the format. + if (widget->testAttribute(Qt::WA_TranslucentBackground)) { QGLFormat modFormat(surfaceFormat); - - if (widget->property("qglTranslucent").toBool() == true) { - modFormat.setSampleBuffers(false); - modFormat.setSamples(0); - modFormat.setAlpha(true); - } - + modFormat.setSampleBuffers(false); + modFormat.setSamples(0); + modFormat.setAlpha(true); ctx = new QGLContext(modFormat, widget); } else ctx = new QGLContext(surfaceFormat, widget); diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp index 13e44b8..b660eb3 100644 --- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp @@ -153,8 +153,3 @@ void QMeeGoGraphicsSystemHelper::setTranslucent(bool translucent) ENSURE_RUNNING_MEEGO; QMeeGoRuntime::setTranslucent(translucent); } - -void QMeeGoGraphicsSystemHelper::setTranslucentWidget(QWidget w, bool translucent) -{ - w.setProperty("qglTranslucent", QVariant(translucent)); -} diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h index 3e1333d..6df3c22 100644 --- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h @@ -182,24 +182,10 @@ public: When called with true, the base window surface will be translucent and initialized with QGLFormat.alpha == true. - This function is *deprecated*. Use ::setTranslucentWidget instead. + This function is *deprecated*. Set Qt::WA_TranslucentBackground attribute + on the top-level widget *before* you show it instead. */ static void setTranslucent(bool translucent); - - //! Sets translucency (alpha) on the given top-level widget. - /*! - This is a new API for enabling GL translucency on top-level widgets. - The specified widget needs to be top-level. When the time comes to create - a window surface for the widget, it'll be created with translucency enabled - (if translucent is true). - - This function has no effect if the widget is already visible or if it's - not a top-level widget. - - This function can be called even if not running MeeGo graphics system. It'll - have no effect though. - */ - static void setTranslucentWidget(QWidget w, bool translucent); }; #endif -- cgit v0.12 From d7294806fc43e8611c4441881e511af5f18c60db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 8 Dec 2010 16:46:09 +0100 Subject: Prevent out-of-bounds memory access in drawhelper. The coordinates should be modulo the image width and height like for all the other tiled blend functions. Covered by perspectives.qps Task-number: QTBUG-15837 Reviewed-by: Olivier Goffart --- src/gui/painting/qdrawhelper.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index a4ab278..024a69d 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -6432,6 +6432,8 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformedTiled(int count, const QSpan *sp int px = int(tx) - (tx < 0); int py = int(ty) - (ty < 0); + px %= image_width; + py %= image_height; if (px < 0) px += image_width; if (py < 0) -- cgit v0.12