mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-21 00:12:06 +02:00
Scale pixmaps smoothly to avoid horrible jagged edges
This commit is contained in:
parent
7f890e571d
commit
a7308cddcc
@ -38,8 +38,7 @@ AlbumItemDelegate::AlbumItemDelegate( QAbstractItemView* parent, AlbumProxyModel
|
||||
, m_model( proxy )
|
||||
{
|
||||
m_shadowPixmap = QPixmap( RESPATH "images/cover-shadow.png" );
|
||||
m_defaultCover = QPixmap( RESPATH "images/no-album-art-placeholder.png" )
|
||||
.scaled( QSize( 120, 120 ), Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
|
||||
m_defaultCover = QPixmap( RESPATH "images/no-album-art-placeholder.png" );
|
||||
}
|
||||
|
||||
|
||||
@ -73,7 +72,8 @@ AlbumItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
// painter->drawPixmap( option.rect.adjusted( 4, 4, -4, -38 ), m_shadowPixmap );
|
||||
|
||||
QPixmap cover = item->cover.isNull() ? m_defaultCover : item->cover;
|
||||
painter->drawPixmap( option.rect.adjusted( 6, 4, -6, -41 ), cover );
|
||||
QRect r = option.rect.adjusted( 6, 4, -6, -41 );
|
||||
painter->drawPixmap( r, cover.scaled( r.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
|
||||
painter->setPen( opt.palette.color( QPalette::Text ) );
|
||||
|
||||
QTextOption to;
|
||||
|
@ -198,7 +198,7 @@ PlaylistItemDelegate::paintShort( QPainter* painter, const QStyleOptionViewItem&
|
||||
painter->setPen( opt.palette.text().color() );
|
||||
|
||||
QRect ir = r.adjusted( 4, 0, -option.rect.width() + option.rect.height() - 8 + r.left(), 0 );
|
||||
painter->drawPixmap( ir, pixmap );
|
||||
painter->drawPixmap( ir, pixmap.scaled( ir.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
|
||||
//painter->drawPixmap( ir, item->cover );
|
||||
|
||||
QFont boldFont = opt.font;
|
||||
|
@ -40,8 +40,7 @@ TreeItemDelegate::TreeItemDelegate( ArtistView* parent, TreeProxyModel* proxy )
|
||||
, m_model( proxy )
|
||||
{
|
||||
m_nowPlayingIcon = QPixmap( RESPATH "images/now-playing-speaker.png" );
|
||||
m_defaultCover = QPixmap( RESPATH "images/no-album-art-placeholder.png" )
|
||||
.scaled( QSize( 120, 120 ), Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
|
||||
m_defaultCover = QPixmap( RESPATH "images/no-album-art-placeholder.png" );
|
||||
}
|
||||
|
||||
|
||||
@ -135,7 +134,7 @@ TreeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
// painter->drawPixmap( r, QPixmap( RESPATH "images/cover-shadow.png" ) );
|
||||
|
||||
QPixmap cover = item->cover.isNull() ? m_defaultCover : item->cover;
|
||||
painter->drawPixmap( r, cover );
|
||||
painter->drawPixmap( r, cover.scaled( r.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
|
||||
|
||||
QTextOption to;
|
||||
to.setAlignment( Qt::AlignVCenter );
|
||||
|
Loading…
x
Reference in New Issue
Block a user