mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-09 15:54:47 -07:00
Reworked deck editor
This commit is contained in:
parent
50b908c7c4
commit
3af5804073
13 changed files with 157 additions and 79 deletions
|
|
@ -587,7 +587,7 @@ void CardInfo::imageLoaded(const QImage &image)
|
|||
|
||||
void CardInfo::getPixmap(QSize size, QPixmap &pixmap)
|
||||
{
|
||||
QString key = QLatin1String("card_") + name + QLatin1Char('_') + QString::number(size.width());
|
||||
QString key = QLatin1String("card_") + name + QLatin1Char('_') + QString::number(size.width()) + QString::number(size.height());
|
||||
if(QPixmapCache::find(key, &pixmap))
|
||||
return;
|
||||
|
||||
|
|
@ -598,15 +598,15 @@ void CardInfo::getPixmap(QSize size, QPixmap &pixmap)
|
|||
pixmap = QPixmap(); // null
|
||||
return;
|
||||
} else {
|
||||
pixmap = QPixmap(size);
|
||||
pixmap.fill(Qt::transparent);
|
||||
QSvgRenderer svg(QString(":/back.svg"));
|
||||
QPainter painter(&pixmap);
|
||||
svg.render(&painter, QRectF(0, 0, size.width(), size.height()));
|
||||
bigPixmap = QPixmap(svg.defaultSize());
|
||||
bigPixmap.fill(Qt::transparent);
|
||||
QPainter painter(&bigPixmap);
|
||||
svg.render(&painter);
|
||||
}
|
||||
} else {
|
||||
pixmap = bigPixmap.scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
|
||||
pixmap = bigPixmap.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
QPixmapCache::insert(key, pixmap);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue