mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-12 21:10:01 -08:00
Added buddy stars to chat
This commit is contained in:
parent
b06b81895b
commit
d5c8f45ab9
5 changed files with 85 additions and 0 deletions
|
|
@ -160,4 +160,20 @@ QPixmap UserLevelPixmapGenerator::generatePixmap(int height, UserLevelFlags user
|
|||
return pixmap;
|
||||
}
|
||||
|
||||
QMap<QString, QPixmap> PixmapGenerator::pmCache;
|
||||
QPixmap PixmapGenerator::generatePixmap(int height, QString resourceName) {
|
||||
if (pmCache.contains(resourceName))
|
||||
return pmCache.value(resourceName);
|
||||
|
||||
QSvgRenderer svg(resourceName);
|
||||
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(resourceName, pixmap);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
QMap<int, QPixmap> UserLevelPixmapGenerator::pmCache;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue