diff --git a/cockatrice/src/abstractcarditem.cpp b/cockatrice/src/abstractcarditem.cpp index 9167cb0e..e9c1b55f 100644 --- a/cockatrice/src/abstractcarditem.cpp +++ b/cockatrice/src/abstractcarditem.cpp @@ -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()) { diff --git a/cockatrice/src/carddatabase.cpp b/cockatrice/src/carddatabase.cpp index 8c0617d6..c6bcd188 100644 --- a/cockatrice/src/carddatabase.cpp +++ b/cockatrice/src/carddatabase.cpp @@ -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); }