summary refs log tree commit diff
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-30 12:35:15 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-30 12:35:15 +0300
commit06b30b3cca37e9217a9658f70be7bdf8e63f74a2 (patch)
tree677e25e0b8bf43ab747e54fbd63fa16c5ba1ce47
parentAdd tab-completion for usernames (diff)
downloadnheko-06b30b3cca37e9217a9658f70be7bdf8e63f74a2.tar.xz
Use double instead of int when scaling pixmaps (#393)
-rw-r--r--src/Utils.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Utils.cpp b/src/Utils.cpp
index 809ea293..e4ca92d6 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -3,6 +3,7 @@
 #include <QApplication>
 #include <QDesktopWidget>
 #include <QSettings>
+#include <cmath>
 
 #include <variant.hpp>
 
@@ -221,7 +222,8 @@ utils::scaleImageToPixmap(const QImage &img, int size)
         if (img.isNull())
                 return QPixmap();
 
-        const int sz = QApplication::desktop()->screen()->devicePixelRatio() * size;
+        const double sz =
+          ceil(QApplication::desktop()->screen()->devicePixelRatioF() * (double)size);
         return QPixmap::fromImage(
           img.scaled(sz, sz, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
 }