mirror of
https://github.com/fergalmoran/flameshot.git
synced 2026-01-08 03:59:41 +00:00
fix - MacOS - pixelate on Retina displays
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
#include <QGraphicsScene>
|
||||
#include <QImage>
|
||||
#include <QPainter>
|
||||
#include <cassert>
|
||||
|
||||
PixelateTool::PixelateTool(QObject* parent)
|
||||
: AbstractTwoPointTool(parent)
|
||||
@@ -65,13 +64,12 @@ void PixelateTool::process(QPainter& painter,
|
||||
QPoint& p0 = m_points.first;
|
||||
QPoint& p1 = m_points.second;
|
||||
QRect selection = QRect(p0, p1).normalized();
|
||||
auto pixelRatio = pixmap.devicePixelRatio();
|
||||
QRect selectionScaled =
|
||||
QRect(p0 * pixelRatio, p1 * pixelRatio).normalized();
|
||||
|
||||
// If thickness is less than 1, use old blur process
|
||||
if (m_thickness <= 1) {
|
||||
auto pixelRatio = pixmap.devicePixelRatio();
|
||||
|
||||
QRect selectionScaled =
|
||||
QRect(p0 * pixelRatio, p1 * pixelRatio).normalized();
|
||||
|
||||
QGraphicsBlurEffect* blur = new QGraphicsBlurEffect;
|
||||
blur->setBlurRadius(10);
|
||||
@@ -93,7 +91,7 @@ void PixelateTool::process(QPainter& painter,
|
||||
int height = selection.height() * (0.5 / qMax(1, m_thickness));
|
||||
QSize size = QSize(qMax(width, 1), qMax(height, 1));
|
||||
|
||||
QPixmap t = pixmap.copy(selection);
|
||||
QPixmap t = pixmap.copy(selectionScaled);
|
||||
t = t.scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
t = t.scaled(selection.width(), selection.height());
|
||||
painter.drawImage(selection, t.toImage());
|
||||
|
||||
Reference in New Issue
Block a user