From c56df535f5bf40ff0afefd10c3b1bf348763c65d Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 11 Sep 2009 11:56:18 +1000 Subject: Use drawTiledPixmap for tiling. So we can take advantage of backend optimizations. --- src/declarative/fx/qfximage.cpp | 36 ++++++------------------------------ 1 file 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 { -- cgit v0.12