diff --git a/src/tools/pixelate/pixelatetool.cpp b/src/tools/pixelate/pixelatetool.cpp index 62de8dbf..13b3d4d4 100644 --- a/src/tools/pixelate/pixelatetool.cpp +++ b/src/tools/pixelate/pixelatetool.cpp @@ -22,7 +22,6 @@ #include #include #include -#include 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());