mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 08:14:47 -07:00
Fixed main chat room lag
This commit is contained in:
parent
19e86c61f0
commit
06accd519c
4 changed files with 737 additions and 131 deletions
|
|
@ -166,3 +166,24 @@ QPixmap UserLevelPixmapGenerator::generatePixmap(int height, UserLevelFlags user
|
|||
}
|
||||
|
||||
QMap<int, QPixmap> UserLevelPixmapGenerator::pmCache;
|
||||
|
||||
|
||||
QPixmap LockPixmapGenerator::generatePixmap(int height)
|
||||
{
|
||||
|
||||
int key = height;
|
||||
if (pmCache.contains(key))
|
||||
return pmCache.value(key);
|
||||
|
||||
QSvgRenderer svg(QString(":/resources/lock.svg"));
|
||||
int width = (int) round(height * (double) svg.defaultSize().width() / (double) svg.defaultSize().height());
|
||||
QPixmap pixmap(width, height);
|
||||
pixmap.fill(Qt::transparent);
|
||||
QPainter painter(&pixmap);
|
||||
svg.render(&painter, QRectF(0, 0, width, height));
|
||||
|
||||
pmCache.insert(key, pixmap);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
QMap<int, QPixmap> LockPixmapGenerator::pmCache;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue