From 6810aa41714aeedf15e143187a4ae1720b1a06f9 Mon Sep 17 00:00:00 2001 From: Be Date: Wed, 23 Oct 2019 22:13:28 -0500 Subject: [PATCH] CoverArtDelegate: simplify pixmap drawing --- src/library/coverartdelegate.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/library/coverartdelegate.cpp b/src/library/coverartdelegate.cpp index 7d032dac28d8..c9c0b7eee576 100644 --- a/src/library/coverartdelegate.cpp +++ b/src/library/coverartdelegate.cpp @@ -112,13 +112,9 @@ void CoverArtDelegate::paintItem(QPainter *painter, // BaseSqlTableModel when a row's cover is ready. QPixmap pixmap = pCache->requestCover(info, this, option.rect.width() * scaleFactor, m_bOnlyCachedCover, true); - pixmap.setDevicePixelRatio(scaleFactor); if (!pixmap.isNull()) { - int width = math_min(pixmap.width(), option.rect.width()) * scaleFactor; - int height = math_min(pixmap.height(), option.rect.height()) * scaleFactor; - QRect target(option.rect.x(), option.rect.y(), width, height); - QRect source(0, 0, target.width() * scaleFactor, target.height() * scaleFactor); - painter->drawPixmap(target, pixmap, source); + pixmap.setDevicePixelRatio(scaleFactor); + painter->drawPixmap(option.rect.topLeft(), pixmap); } else if (!m_bOnlyCachedCover) { // If we asked for a non-cache image and got a null pixmap, then our // request was queued.