From 21cf49a0097b6e5679f78a0713a9db19a2de5495 Mon Sep 17 00:00:00 2001 From: defnax Date: Mon, 20 Jan 2020 20:12:26 +0100 Subject: [PATCH] added to check pixmap width & height before scale, only scale when needed --- retroshare-gui/src/gui/Posted/PhotoView.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/retroshare-gui/src/gui/Posted/PhotoView.cpp b/retroshare-gui/src/gui/Posted/PhotoView.cpp index 16b74c793..5e099ba01 100644 --- a/retroshare-gui/src/gui/Posted/PhotoView.cpp +++ b/retroshare-gui/src/gui/Posted/PhotoView.cpp @@ -53,7 +53,10 @@ void PhotoView::setPixmap(const QPixmap& pixmap) { QPixmap sqpixmap = pixmap.scaled(640,480, Qt::KeepAspectRatio, Qt::SmoothTransformation); - ui->photoLabel->setPixmap(sqpixmap); + if(pixmap.width() > 800 || pixmap.height() > 700) + ui->photoLabel->setPixmap(sqpixmap); + else + ui->photoLabel->setPixmap(pixmap); } void PhotoView::setTitle(const QString& text) @@ -67,7 +70,7 @@ void PhotoView::setName(const RsGxsId& authorID) RsIdentityDetails idDetails ; rsIdentity->getIdDetails(authorID,idDetails); - + QPixmap pixmap ; if(idDetails.mAvatar.mSize == 0 || !GxsIdDetails::loadPixmapFromData(idDetails.mAvatar.mData, idDetails.mAvatar.mSize, pixmap,GxsIdDetails::SMALL))