scaled pixmap cache. major speed improvement

This commit is contained in:
brukie 2009-06-03 15:38:21 +02:00
parent 1da5c63726
commit 04072b02d1
10 changed files with 57 additions and 45 deletions

View file

@ -12,8 +12,6 @@ LibraryZone::LibraryZone(Player *_p, QGraphicsItem *parent)
cards = new CardList(false);
setCacheMode(DeviceCoordinateCache); // Do not move this line to the parent constructor!
setCursor(Qt::OpenHandCursor);
image = player->getDb()->getCard()->getPixmap();
}
QRectF LibraryZone::boundingRect() const
@ -25,9 +23,9 @@ void LibraryZone::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio
{
painter->save();
QRectF foo = option->matrix.mapRect(boundingRect());
QPixmap bar = image->scaled((int) foo.width(), (int) foo.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
painter->drawPixmap(boundingRect(), bar, bar.rect());
QSizeF translatedSize = option->matrix.mapRect(boundingRect()).size();
QPixmap *translatedPixmap = player->getDb()->getCard()->getPixmap(translatedSize.toSize());
painter->drawPixmap(boundingRect(), *translatedPixmap, translatedPixmap->rect());
paintCardNumberEllipse(painter);