Fix icon size not even

Change-Id: I2c06e31dabddcdafe909390069941c99ded48357
This commit is contained in:
石博文 2017-02-23 10:54:40 +08:00
parent 26f189d5a8
commit b64c3b7f25
Notes: Deepin Code Review 2017-02-23 11:14:43 +08:00
Verified+1: Anonymous Coward #1000004
Code-Review+2: 石博文 <sbw@sbw.so>
Submitted-by: 石博文 <sbw@sbw.so>
Submitted-at: Thu, 23 Feb 2017 11:14:39 +0800
Reviewed-on: https://cr.deepin.io/20646
Project: dde/dde-dock
Branch: refs/heads/master

View File

@ -16,6 +16,8 @@ ThemeAppIcon::~ThemeAppIcon()
const QPixmap ThemeAppIcon::getIcon(const QString iconName, const int size)
{
const int s = size & ~1;
QPixmap pixmap;
do {
@ -38,7 +40,7 @@ const QPixmap ThemeAppIcon::getIcon(const QString iconName, const int size)
}
const QIcon icon = QIcon::fromTheme(iconName, QIcon::fromTheme("application-x-desktop"));
pixmap = icon.pixmap(QSize(size, size));
pixmap = icon.pixmap(QSize(s, s));
if (!pixmap.isNull())
break;
@ -50,6 +52,6 @@ const QPixmap ThemeAppIcon::getIcon(const QString iconName, const int size)
} while (false);
return pixmap.scaled(size, size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
return pixmap.scaled(s, s, Qt::KeepAspectRatio, Qt::SmoothTransformation);
}