Do not stretch icons but use the smaller one with padding
Thanks to Iceweasel for providing a maximum icon of 48x48 which looks really bad when upscaled to 128x128. Orig icon is placed in the center of a new pixmap in requested size.
This commit is contained in:
parent
f27a00d8cd
commit
d89b9b3abe
1 changed files with 8 additions and 0 deletions
|
@ -77,6 +77,14 @@ QPixmap ImageProvider::requestPixmap(const QString &id, QSize *size, const QSize
|
|||
}
|
||||
*size = s;
|
||||
QPixmap icon = client->icon(s);
|
||||
if (s.width() > icon.width() || s.height() > icon.height()) {
|
||||
// icon is smaller than what we requested - QML would scale it which looks bad
|
||||
QPixmap temp(s);
|
||||
temp.fill(Qt::transparent);
|
||||
QPainter p(&temp);
|
||||
p.drawPixmap(s.width()/2 - icon.width()/2, s.height()/2 - icon.height()/2, icon);
|
||||
icon = temp;
|
||||
}
|
||||
if (parts.size() > 2) {
|
||||
KIconEffect *effect = KIconLoader::global()->iconEffect();
|
||||
KIconLoader::States state = KIconLoader::DefaultState;
|
||||
|
|
Loading…
Reference in a new issue