1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-09-10 12:03:18 +02:00

previewrender: do not overflow if ratio is greater than 1

Change-Id: Id7f443a354691d7b5b0a71e6e8b35a4cd0005a88
GitLab: #611
This commit is contained in:
Sébastien Blin 2021-12-06 16:11:51 -05:00
parent 335b2e5f12
commit 9c0bba79b2

View file

@ -53,8 +53,8 @@ PreviewRenderer::paint(QPainter* painter)
auto aspectRatio = static_cast<qreal>(previewImage->width())
/ static_cast<qreal>(previewImage->height());
auto previewHeight = height();
auto previewWidth = previewHeight * aspectRatio;
auto previewHeight = aspectRatio < 1 ? height() : width() / aspectRatio;
auto previewWidth = aspectRatio < 1 ? previewHeight * aspectRatio : width();
/* Instead of setting fixed size, we could get an x offset for the preview
* but this would render the horizontal spacers in the parent widget useless.