Skip to content
This repository has been archived by the owner on Oct 17, 2019. It is now read-only.

Commit

Permalink
Use double instead of int when scaling pixmaps (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
mujx committed Jul 30, 2018
1 parent 6ffb747 commit 06b30b3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <QApplication>
#include <QDesktopWidget>
#include <QSettings>
#include <cmath>

#include <variant.hpp>

Expand Down Expand Up @@ -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));
}
Expand Down

0 comments on commit 06b30b3

Please sign in to comment.