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

@ -42,12 +42,13 @@ void CardInfoWidget::setCard(CardInfo *card)
if (!card)
return;
QPixmap *pixmap = card->getPixmap();
if (aspectratio == 0)
aspectratio = (double) pixmap->height() / pixmap->width();
if (aspectratio == 0) {
QPixmap *bigPixmap = card->loadPixmap();
aspectratio = (double) bigPixmap->height() / bigPixmap->width();
}
double w = 180;
cardPicture->setPixmap(pixmap->scaled((int) w, (int) (w * aspectratio), Qt::KeepAspectRatio, Qt::SmoothTransformation));
cardPicture->setPixmap(*card->getPixmap(QSize(w, w * aspectratio)));
nameLabel2->setText(card->getName());
manacostLabel2->setText(card->getManacost());
cardtypeLabel2->setText(card->getCardType());