Use double instead of int when scaling pixmaps (#393)

This commit is contained in:
Konstantinos Sideris 2018-07-30 12:35:15 +03:00
parent 6ffb747421
commit 06b30b3cca

View file

@ -3,6 +3,7 @@
#include <QApplication> #include <QApplication>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QSettings> #include <QSettings>
#include <cmath>
#include <variant.hpp> #include <variant.hpp>
@ -221,7 +222,8 @@ utils::scaleImageToPixmap(const QImage &img, int size)
if (img.isNull()) if (img.isNull())
return QPixmap(); return QPixmap();
const int sz = QApplication::desktop()->screen()->devicePixelRatio() * size; const double sz =
ceil(QApplication::desktop()->screen()->devicePixelRatioF() * (double)size);
return QPixmap::fromImage( return QPixmap::fromImage(
img.scaled(sz, sz, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); img.scaled(sz, sz, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
} }