mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 08:34:52 -07:00
scaled pixmap cache. major speed improvement
This commit is contained in:
parent
1da5c63726
commit
04072b02d1
10 changed files with 57 additions and 45 deletions
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue