Merge pull request #911 from ctrlaltca/fix_67
Large decks (up to 8000-ish cards) no longer make client crash; Fix #67
This commit is contained in:
commit
6f69485f99
2 changed files with 7 additions and 2 deletions
|
@ -91,7 +91,10 @@ void AbstractCardItem::paintPicture(QPainter *painter, const QSizeF &translatedS
|
|||
|
||||
CardInfo *imageSource = facedown ? db->getCard() : info;
|
||||
QPixmap translatedPixmap;
|
||||
imageSource->getPixmap(translatedSize.toSize(), translatedPixmap);
|
||||
// don't even spend time trying to load the picture if our size is too small
|
||||
if(translatedSize.width() > 10)
|
||||
imageSource->getPixmap(translatedSize.toSize(), translatedPixmap);
|
||||
|
||||
painter->save();
|
||||
QColor bgColor = Qt::transparent;
|
||||
if (translatedPixmap.isNull()) {
|
||||
|
|
|
@ -970,7 +970,9 @@ QStringList CardDatabase::getAllMainCardTypes() const
|
|||
void CardDatabase::cacheCardPixmaps(const QStringList &cardNames)
|
||||
{
|
||||
QPixmap tmp;
|
||||
for (int i = 0; i < cardNames.size(); ++i)
|
||||
// never cache more than 300 cards at once for a single deck
|
||||
int max = qMin(cardNames.size(), 300);
|
||||
for (int i = 0; i < max; ++i)
|
||||
getCard(cardNames[i])->loadPixmap(tmp);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue