diff options
author | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-07-29 06:41:15 (GMT) |
---|---|---|
committer | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-07-29 06:41:17 (GMT) |
commit | 854acb3478651312dbe84d9b4ef971b46485fe1f (patch) | |
tree | 069cf9d1774eafe1a235e26f74e43f59085bbd33 /src/gui/graphicsview/qgraphicsitem_p.h | |
parent | e646d08593dc18cad4e59176c2fe8c10fa5b9497 (diff) | |
download | Qt-854acb3478651312dbe84d9b4ef971b46485fe1f.zip Qt-854acb3478651312dbe84d9b4ef971b46485fe1f.tar.gz Qt-854acb3478651312dbe84d9b4ef971b46485fe1f.tar.bz2 |
Add QGraphicsSourceEffect.
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem_p.h')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem_p.h | 56 |
1 files changed, 31 insertions, 25 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index dc875f7..0823e51 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -510,44 +510,50 @@ struct QGraphicsItemPrivate::TransformData { } }; -class QGraphicsItemEffectSource : public QGraphicsEffectSource +struct QGraphicsItemPaintInfo +{ + inline QGraphicsItemPaintInfo(const QTransform *const xform1, QTransform *xform2, + QRegion *r, QWidget *w, QStyleOptionGraphicsItem *opt, + qreal o, bool b1, bool b2) + : viewTransform(xform1), transformPtr(xform2), exposedRegion(r), widget(w), + option(opt), opacity(o), wasDirtySceneTransform(b1), drawItem(b2) + {} + + const QTransform *viewTransform; + QTransform *transformPtr; + QRegion *exposedRegion; + QWidget *widget; + QStyleOptionGraphicsItem *option; + qreal opacity; + quint32 wasDirtySceneTransform : 1; + quint32 drawItem : 1; +}; + +class QGraphicsItemEffectSourcePrivate : public QGraphicsEffectSourcePrivate { public: - QGraphicsItemEffectSource(QGraphicsItem *i) - : QGraphicsEffectSource(), item(i), option(0), widget(0) + QGraphicsItemEffectSourcePrivate(QGraphicsItem *i) + : QGraphicsEffectSourcePrivate(), item(i), info(0) {} inline void detach() { item->setGraphicsEffect(0); } - inline QRectF boundingRect() - { return item->boundingRect(); } + inline const QGraphicsItem *graphicsItem() const + { return item; } - inline void draw(QPainter *painter) - { item->paint(painter, option, widget); } + inline const QStyleOption *styleOption() const + { return info ? info->option : 0; } - inline bool drawIntoPixmap(QPixmap *pixmap, const QTransform &itemToPixmapTransform) - { - pixmap->fill(Qt::transparent); - QPainter pixmapPainter(pixmap); - if (!itemToPixmapTransform.isIdentity()) - pixmapPainter.setWorldTransform(itemToPixmapTransform); - item->paint(&pixmapPainter, option, widget); - return true; - } - - inline void setPaintInfo(const QStyleOptionGraphicsItem *o, QWidget *w) - { option = o; widget = w; } + QRectF boundingRect(bool deviceCoordinates) const; + void draw(QPainter *); + bool drawIntoPixmap(QPixmap *pixmap, const QPoint &offset); - void resetPaintInfo() - { option = 0; widget = 0; } - -private: QGraphicsItem *item; - const QStyleOptionGraphicsItem *option; - QWidget *widget; + QGraphicsItemPaintInfo *info; }; + /*! \internal */ |