Merge pull request #3241 from Bowser65/feature/render-overlay

Minor: Render the skin overlay in SkinUtils
This commit is contained in:
Petr Mrázek 2020-07-18 12:31:14 +02:00 committed by GitHub
commit 814407ccec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,7 @@
#include "Env.h"
#include <QFile>
#include <QPainter>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
@ -35,10 +36,14 @@ QPixmap getFaceFromCache(QString username, int height, int width)
if (fskin.exists())
{
QPixmap skin(fskin.fileName());
if(!skin.isNull())
QPixmap skinTexture(fskin.fileName());
if(!skinTexture.isNull())
{
return skin.copy(8, 8, 8, 8).scaled(height, width, Qt::KeepAspectRatio);
QPixmap skin = QPixmap(8, 8);
QPainter painter(&skin);
painter.drawPixmap(0, 0, skinTexture.copy(8, 8, 8, 8));
painter.drawPixmap(0, 0, skinTexture.copy(40, 8, 8, 8));
return skin.scaled(height, width, Qt::KeepAspectRatio);
}
}