diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2010-06-28 13:56:33 (GMT) |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2010-07-02 08:24:49 (GMT) |
commit | f5c5e20ab20f016c07351330d03432e4912f20b2 (patch) | |
tree | 76cf3ab1a1207744450df9564506857e6368ecca /tests/auto/qgraphicseffectsource | |
parent | 1a38ba1dcd7629f74bcaed48793dff441c16dc8b (diff) | |
download | Qt-f5c5e20ab20f016c07351330d03432e4912f20b2.zip Qt-f5c5e20ab20f016c07351330d03432e4912f20b2.tar.gz Qt-f5c5e20ab20f016c07351330d03432e4912f20b2.tar.bz2 |
Fixed missing clip when computing the graphics item effect source rect.
If item clips children to shape we should take that into account when
computing the source rect, to avoid creating unnecessary large source
pixmaps which might have a significant performance impact.
Task-number: QT-3551
Reviewed-by: Gunnar
Reviewed-by: Trond
Diffstat (limited to 'tests/auto/qgraphicseffectsource')
-rw-r--r-- | tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp index 49f110e..49a76fa 100644 --- a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp +++ b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp @@ -161,6 +161,7 @@ private slots: void draw(); void update(); void boundingRect(); + void clippedBoundingRect(); void deviceRect(); void pixmap(); @@ -282,6 +283,20 @@ void tst_QGraphicsEffectSource::boundingRect() QTRY_COMPARE(effect->source()->boundingRect(), itemBoundingRect); } +void tst_QGraphicsEffectSource::clippedBoundingRect() +{ + QRectF itemBoundingRect = item->boundingRect(); + item->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + + QGraphicsRectItem *child = new QGraphicsRectItem(-1000, -1000, 2000, 2000); + child->setBrush(Qt::red); + child->setParentItem(item); + + effect->storeDeviceDependentStuff = true; + effect->source()->update(); + QTRY_COMPARE(effect->source()->boundingRect(Qt::LogicalCoordinates), itemBoundingRect); +} + void tst_QGraphicsEffectSource::deviceRect() { effect->storeDeviceDependentStuff = true; |