Skip to content

Commit

Permalink
CoverArtDelegate: compare numbers in appropriate scale
Browse files Browse the repository at this point in the history
pixmap's dimensions are in real pixels, option.rect is
device-independent pixels
  • Loading branch information
Be-ing committed Oct 24, 2019
1 parent 146f399 commit ccd039b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/library/coverartdelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ void CoverArtDelegate::paintItem(QPainter *painter,
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;
int width = math_min(static_cast<double>(pixmap.width()), option.rect.width() * scaleFactor);
int height = math_min(static_cast<double>(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);
Expand Down

0 comments on commit ccd039b

Please sign in to comment.