summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-08-04 17:50:07 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-08-04 17:53:49 (GMT)
commite7c4967ec89cbc10dcc9127480532347264edca3 (patch)
tree1be1e0ce49869358f41b1c12c3528a7e5f33ba2b /src/gui
parentd7166584025d90dda52a859987f4dfaae12d6004 (diff)
downloadQt-e7c4967ec89cbc10dcc9127480532347264edca3.zip
Qt-e7c4967ec89cbc10dcc9127480532347264edca3.tar.gz
Qt-e7c4967ec89cbc10dcc9127480532347264edca3.tar.bz2
Make tst_QGraphicsEffectSource::boundingRect happy.
We cannot modify the transformPtr directly because we might want to use the original transform later. The problem in this particular case was that we called source->pixmap() (which modified the transformPtr), then source->boundingRect(Qt::DeviceCoordinates) which in turn used wrong transform to map the bounding rect.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h4
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp15
-rw-r--r--src/gui/graphicsview/qgraphicsscene_p.h2
3 files changed, 12 insertions, 9 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index c01ee1a..76c9dab 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -516,7 +516,7 @@ struct QGraphicsItemPrivate::TransformData {
struct QGraphicsItemPaintInfo
{
- inline QGraphicsItemPaintInfo(const QTransform *const xform1, QTransform *xform2,
+ inline QGraphicsItemPaintInfo(const QTransform *const xform1, const QTransform *const xform2,
QRegion *r, QWidget *w, QStyleOptionGraphicsItem *opt,
QPainter *p, qreal o, bool b1, bool b2)
: viewTransform(xform1), transformPtr(xform2), exposedRegion(r), widget(w),
@@ -524,7 +524,7 @@ struct QGraphicsItemPaintInfo
{}
const QTransform *viewTransform;
- QTransform *transformPtr;
+ const QTransform *transformPtr;
QRegion *exposedRegion;
QWidget *widget;
QStyleOptionGraphicsItem *option;
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index ddd2550..c898a3e 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4366,8 +4366,9 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
}
void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const QTransform *const viewTransform,
- QTransform *transformPtr, QRegion *exposedRegion, QWidget *widget, qreal opacity,
- const QTransform *effectTransform, bool wasDirtyParentSceneTransform, bool drawItem)
+ const QTransform *const transformPtr, QRegion *exposedRegion, QWidget *widget,
+ qreal opacity, const QTransform *effectTransform,
+ bool wasDirtyParentSceneTransform, bool drawItem)
{
const bool itemIsFullyTransparent = (opacity < 0.0001);
const bool itemClipsChildrenToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape);
@@ -4381,8 +4382,9 @@ void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const Q
painter->save();
Q_ASSERT(transformPtr);
if (effectTransform)
- *transformPtr *= *effectTransform;
- painter->setWorldTransform(*transformPtr);
+ painter->setWorldTransform(*transformPtr * *effectTransform);
+ else
+ painter->setWorldTransform(*transformPtr);
painter->setClipPath(item->shape(), Qt::IntersectClip);
}
@@ -4414,8 +4416,9 @@ void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const Q
if (!itemHasChildren || !itemClipsChildrenToShape) {
if (effectTransform)
- *transformPtr *= *effectTransform;
- painter->setWorldTransform(*transformPtr);
+ painter->setWorldTransform(*transformPtr * *effectTransform);
+ else
+ painter->setWorldTransform(*transformPtr);
}
if (itemClipsToShape)
diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h
index 6223101..0422124 100644
--- a/src/gui/graphicsview/qgraphicsscene_p.h
+++ b/src/gui/graphicsview/qgraphicsscene_p.h
@@ -204,7 +204,7 @@ public:
void drawSubtreeRecursive(QGraphicsItem *item, QPainter *painter, const QTransform *const,
QRegion *exposedRegion, QWidget *widget, qreal parentOpacity = qreal(1.0),
const QTransform *const effectTransform = 0);
- void draw(QGraphicsItem *, QPainter *, const QTransform *const, QTransform *,
+ void draw(QGraphicsItem *, QPainter *, const QTransform *const, const QTransform *const,
QRegion *, QWidget *, qreal, const QTransform *const, bool, bool);
void markDirty(QGraphicsItem *item, const QRectF &rect = QRectF(), bool invalidateChildren = false,