┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/pixmapviewer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pixmapviewer.cpp')
-rw-r--r--src/pixmapviewer.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/pixmapviewer.cpp b/src/pixmapviewer.cpp
index 36d583c1d..e4d417d47 100644
--- a/src/pixmapviewer.cpp
+++ b/src/pixmapviewer.cpp
@@ -65,11 +65,12 @@ void PixmapViewer::paintEvent(QPaintEvent* event)
const int x = (width() - scaledWidth ) / 2;
const int y = (height() - scaledHeight) / 2;
- if (m_oldPixmap.width() > m_pixmap.width()) {
- painter.drawPixmap(x, y, m_oldPixmap.scaled(scaledWidth, scaledHeight));
- } else {
- painter.drawPixmap(x, y, m_pixmap.scaled(scaledWidth, scaledHeight));
- }
+ const QPixmap& largePixmap = (m_oldPixmap.width() > m_pixmap.width()) ? m_oldPixmap : m_pixmap;
+ const QPixmap scaledPixmap = largePixmap.scaled(scaledWidth,
+ scaledHeight,
+ Qt::IgnoreAspectRatio,
+ Qt::SmoothTransformation);
+ painter.drawPixmap(x, y, scaledPixmap);
}
#include "pixmapviewer.moc"