Skip to content

Commit

Permalink
Fix transparency in skin icon
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
lumiscosity committed Aug 10, 2023
1 parent 7c547f6 commit 97ef8e8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions launcher/SkinUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
1 change: 1 addition & 0 deletions launcher/minecraft/auth/MinecraftAccount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 97ef8e8

Please sign in to comment.