Merge pull request #1211 from PhenomRetroShare/Fix_AvatarStatusOverlay

Fix Friend Avatar status overlay no depends size scale.
This commit is contained in:
csoler 2018-03-14 20:56:30 +01:00 committed by GitHub
commit 6e8305abda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -501,13 +501,12 @@ static QIcon createAvatar(const QPixmap &avatar, const QPixmap &overlay)
QPixmap pixmap(avatar);
int overlayWidth = avatarWidth / 2.5;
int overlayHeight = avatarHeight / 2.5;
int overlayX = avatarWidth - overlayWidth;
int overlayY = avatarHeight - overlayHeight;
int overlaySize = (avatarWidth > avatarHeight) ? (avatarWidth/2.5) : (avatarHeight/2.5);
int overlayX = avatarWidth - overlaySize;
int overlayY = avatarHeight - overlaySize;
QPainter painter(&pixmap);
painter.drawPixmap(overlayX, overlayY, overlayWidth, overlayHeight, overlay);
painter.drawPixmap(overlayX, overlayY, overlaySize, overlaySize, overlay);
QIcon icon;
icon.addPixmap(pixmap);