From: Peter Penz Date: Mon, 16 Apr 2007 21:30:49 +0000 (+0000) Subject: use the smooth transformation mode for scaling X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/fc3134bdee19aa4b1c482435ae7fbf01eacb6d4c use the smooth transformation mode for scaling svn path=/trunk/KDE/kdebase/apps/; revision=654769 --- 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"