┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2007-04-16 21:30:49 +0000
committerPeter Penz <[email protected]>2007-04-16 21:30:49 +0000
commitfc3134bdee19aa4b1c482435ae7fbf01eacb6d4c (patch)
treeb0ed5b224782b44ed9fb2a6d04e4cd78425ed4dd /src
parentda3bc09d21b43837873c899e2fbda1fa6c2a2e5e (diff)
use the smooth transformation mode for scaling
svn path=/trunk/KDE/kdebase/apps/; revision=654769
Diffstat (limited to 'src')
-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"