mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
implemented direct chat
This commit is contained in:
parent
a8e166b609
commit
e597325ec3
24 changed files with 821 additions and 335 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#include <QPainter>
|
||||
#include <QSvgRenderer>
|
||||
#include <math.h>
|
||||
#include <QDebug>
|
||||
|
||||
QPixmap PingPixmapGenerator::generatePixmap(int size, int value, int max)
|
||||
{
|
||||
|
|
@ -39,11 +40,13 @@ QPixmap CountryPixmapGenerator::generatePixmap(int height, const QString &countr
|
|||
return pmCache.value(key);
|
||||
|
||||
QSvgRenderer svg(QString(":/resources/countries/" + countryCode + ".svg"));
|
||||
double aspect = (double) svg.defaultSize().width() / (double) svg.defaultSize().height();
|
||||
QPixmap pixmap((int) round(aspect * height), height);
|
||||
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, aspect * height, height));
|
||||
svg.render(&painter, QRectF(0, 0, width, height));
|
||||
painter.setPen(Qt::black);
|
||||
painter.drawRect(0.5, 0.5, width - 1, height - 1);
|
||||
|
||||
pmCache.insert(key, pixmap);
|
||||
return pixmap;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue