Commit 6f69485f authored by Zach's avatar Zach
Browse files

Merge pull request #911 from ctrlaltca/fix_67

Large decks (up to 8000-ish cards) no longer make client crash; Fix #67
parents 0b4b8e85 0a366d75
......@@ -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);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment