summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-09-11 01:56:18 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-09-11 01:56:18 (GMT)
commitc56df535f5bf40ff0afefd10c3b1bf348763c65d (patch)
tree29509173327b1668203515d8c484bffea64bfba9
parentabfa26ff5be47edcf38a48bacb4bd310badca09e (diff)
downloadQt-c56df535f5bf40ff0afefd10c3b1bf348763c65d.zip
Qt-c56df535f5bf40ff0afefd10c3b1bf348763c65d.tar.gz
Qt-c56df535f5bf40ff0afefd10c3b1bf348763c65d.tar.bz2
Use drawTiledPixmap for tiling.
So we can take advantage of backend optimizations.
-rw-r--r--src/declarative/fx/qfximage.cpp36
1 files changed, 6 insertions, 30 deletions
diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp
index 99e1b72..79b3ae1 100644
--- a/src/declarative/fx/qfximage.cpp
+++ b/src/declarative/fx/qfximage.cpp
@@ -255,36 +255,12 @@ void QFxImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
p->save();
p->setClipRect(0, 0, width(), height(), Qt::IntersectClip);
- if (d->fillMode == Tile) {
- const int pw = d->pix.width();
- const int ph = d->pix.height();
- int yy = 0;
-
- while(yy < height()) {
- int xx = 0;
- while(xx < width()) {
- p->drawPixmap(xx, yy, d->pix);
- xx += pw;
- }
- yy += ph;
- }
- } else if (d->fillMode == TileVertically) {
- const int ph = d->pix.height();
- int yy = 0;
-
- while(yy < height()) {
- p->drawPixmap(QRect(0, yy, width(), ph), d->pix);
- yy += ph;
- }
- } else {
- const int pw = d->pix.width();
- int xx = 0;
-
- while(xx < width()) {
- p->drawPixmap(QRect(xx, 0, pw, height()), d->pix);
- xx += pw;
- }
- }
+ if (d->fillMode == Tile)
+ p->drawTiledPixmap(QRectF(0,0,width(),height()), d->pix);
+ else if (d->fillMode == TileVertically)
+ p->drawTiledPixmap(QRectF(0,0,d->pix.width(),height()), d->pix);
+ else
+ p->drawTiledPixmap(QRectF(0,0,width(),d->pix.height()), d->pix);
p->restore();
} else {