- 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);
+ const bool useOldPixmap = (m_transition == SizeTransition) &&
+ (m_oldPixmap.width() > m_pixmap.width());
+ const QPixmap& largePixmap = useOldPixmap ? m_oldPixmap : m_pixmap;
+ const QPixmap scaledPixmap = largePixmap.scaled(scaledWidth,
+ scaledHeight,
+ Qt::IgnoreAspectRatio,
+ Qt::FastTransformation);
+ painter.drawPixmap(x, y, scaledPixmap);
+ } else {
+ const int x = (width() - m_pixmap.width() ) / 2;
+ const int y = (height() - m_pixmap.height()) / 2;
+ painter.drawPixmap(x, y, m_pixmap);
+ }
+}
+
+void PixmapViewer::checkPendingPixmaps()
+{
+ if (m_pendingPixmaps.count() > 0) {
+ QPixmap pixmap = m_pendingPixmaps.dequeue();
+ m_oldPixmap = m_pixmap.isNull() ? pixmap : m_pixmap;
+ m_pixmap = pixmap;
+ update();
+ m_animation.start();
+ } else {
+ m_oldPixmap = m_pixmap;
+ }