summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-09-18 12:48:00 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-09-18 13:02:25 (GMT)
commit169099b5e9c77c6633deb3c7bb949800a5f80ec2 (patch)
treeef6cdfe6cc003e08e0b62c66f30b8203054c2bcf /src
parent99005e254b6055e63fc432efd38b9a5a2d0ffcc9 (diff)
downloadQt-169099b5e9c77c6633deb3c7bb949800a5f80ec2.zip
Qt-169099b5e9c77c6633deb3c7bb949800a5f80ec2.tar.gz
Qt-169099b5e9c77c6633deb3c7bb949800a5f80ec2.tar.bz2
Fixed broken scrolling of cached graphics items on X11.
The scrolling was broken in other graphics systems than the native, since _q_scrollPixmap assumed that all QPixmaps were using the X11 backend. We can just use QPixmap::scroll instead, which should also make it faster with the raster paint engine than creating a temporary painter and doing a blit. Also, _q_scrollPixmap would do blending instead of blitting for non-opaque pixmaps. Reviewed-by: Olivier Goffart
Diffstat (limited to 'src')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp42
1 files changed, 1 insertions, 41 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 81eeb39..31c106b 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -5075,46 +5075,6 @@ void QGraphicsItem::update(const QRectF &rect)
}
/*!
- \internal
-
- Scrolls \a rect in \a pix by \a dx, \a dy.
-
- ### This can be done much more efficiently by using XCopyArea on X11 with
- the same dst and src, and through moving pixels in the raster engine. It
- can probably also be done much better on the other paint engines.
-*/
-void _q_scrollPixmap(QPixmap *pix, const QRect &rect, int dx, int dy)
-{
-#if 0
- QPainter painter(pix);
- painter.setClipRect(rect);
- painter.drawPixmap(rect.translated(dx, dy), *pix, rect);
- painter.end();
-#elif defined Q_WS_X11
- GC gc = XCreateGC(X11->display, pix->handle(), 0, 0);
-
- XRectangle xrect;
- xrect.x = rect.x();
- xrect.y = rect.y();
- xrect.width = rect.width();
- xrect.height = rect.height();
- XSetClipRectangles(X11->display, gc, 0, 0, &xrect, 1, YXBanded);
-
- XCopyArea(X11->display, pix->handle(), pix->handle(), gc,
- rect.x(), rect.y(), rect.width(), rect.height(),
- rect.x()+dx, rect.y()+dy);
- XFreeGC(X11->display, gc);
-#else
- QPixmap newPix = *pix;
- QPainter painter(&newPix);
- painter.setClipRect(rect);
- painter.drawPixmap(rect.translated(dx, dy), *pix, rect);
- painter.end();
- *pix = newPix;
-#endif
-}
-
-/*!
\since 4.4
Scrolls the contents of \a rect by \a dx, \a dy. If \a rect is a null rect
(the default), the item's bounding rect is scrolled.
@@ -5154,7 +5114,7 @@ void QGraphicsItem::scroll(qreal dx, qreal dy, const QRectF &rect)
QRectF br = boundingRect().adjusted(-adjust, -adjust, adjust, adjust);
QRect irect = rect.toRect().translated(-br.x(), -br.y());
- _q_scrollPixmap(&pix, irect, dx, dy);
+ pix.scroll(dx, dy, irect);
QPixmapCache::replace(c->key, pix);