From fc3134bdee19aa4b1c482435ae7fbf01eacb6d4c Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Mon, 16 Apr 2007 21:30:49 +0000 Subject: [PATCH] use the smooth transformation mode for scaling svn path=/trunk/KDE/kdebase/apps/; revision=654769 --- src/pixmapviewer.cpp | 11 ++++++----- 1 file 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" -- 2.47.3