mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
Use double instead of int when scaling pixmaps (#393)
This commit is contained in:
parent
6ffb747421
commit
06b30b3cca
1 changed files with 3 additions and 1 deletions
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue