]> cloud.milkyroute.net Git - dolphin.git/commitdiff
use the smooth transformation mode for scaling
authorPeter Penz <peter.penz19@gmail.com>
Mon, 16 Apr 2007 21:30:49 +0000 (21:30 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Mon, 16 Apr 2007 21:30:49 +0000 (21:30 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=654769

src/pixmapviewer.cpp

index 36d583c1d059ddd2241e573a7c1ba4f06d1a615b..e4d417d47171c3d8da2967fc4f9e7a61274435c5 100644 (file)
@@ -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"