Fix transparency in skin icon

QPainter has a bug where drawing transparency to a freshly initialized, empty QPixmap causes garbage data to be drawn. This broke the rendering of the skin icon. The fix is simply to fill the QPixmap with empty transparent pixels beforehand.

Signed-off-by: maple! <averyrudelphe@gmail.com>
This commit is contained in:
maple! 2023-08-10 15:32:47 +02:00
parent 7c547f6452
commit 97ef8e8d0e
2 changed files with 2 additions and 0 deletions

View File

@ -35,6 +35,7 @@ QPixmap getFaceFromCache(QString username, int height, int width)
QPixmap skinTexture(fskin.fileName());
if (!skinTexture.isNull()) {
QPixmap skin = QPixmap(8, 8);
skin.fill(QColorConstants::Transparent);
QPainter painter(&skin);
painter.drawPixmap(0, 0, skinTexture.copy(8, 8, 8, 8));
painter.drawPixmap(0, 0, skinTexture.copy(40, 8, 8, 8));

View File

@ -126,6 +126,7 @@ QPixmap MinecraftAccount::getFace() const
return QPixmap();
}
QPixmap skin = QPixmap(8, 8);
skin.fill(QColorConstants::Transparent);
QPainter painter(&skin);
painter.drawPixmap(0, 0, skinTexture.copy(8, 8, 8, 8));
painter.drawPixmap(0, 0, skinTexture.copy(40, 8, 8, 8));