mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 16:24:45 -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
|
|
@ -12,8 +12,6 @@ LibraryZone::LibraryZone(Player *_p, QGraphicsItem *parent)
|
|||
cards = new CardList(false);
|
||||
setCacheMode(DeviceCoordinateCache); // Do not move this line to the parent constructor!
|
||||
setCursor(Qt::OpenHandCursor);
|
||||
|
||||
image = player->getDb()->getCard()->getPixmap();
|
||||
}
|
||||
|
||||
QRectF LibraryZone::boundingRect() const
|
||||
|
|
@ -25,9 +23,9 @@ void LibraryZone::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio
|
|||
{
|
||||
painter->save();
|
||||
|
||||
QRectF foo = option->matrix.mapRect(boundingRect());
|
||||
QPixmap bar = image->scaled((int) foo.width(), (int) foo.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
painter->drawPixmap(boundingRect(), bar, bar.rect());
|
||||
QSizeF translatedSize = option->matrix.mapRect(boundingRect()).size();
|
||||
QPixmap *translatedPixmap = player->getDb()->getCard()->getPixmap(translatedSize.toSize());
|
||||
painter->drawPixmap(boundingRect(), *translatedPixmap, translatedPixmap->rect());
|
||||
|
||||
paintCardNumberEllipse(painter);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue