From c8767e7a1b491da8ce2ee9a60adbc943b5651f7d Mon Sep 17 00:00:00 2001 From: Ash Holland Date: Sat, 10 Oct 2020 14:24:33 +0100 Subject: [PATCH] Fix pixelation of small areas --- src/tools/pixelate/pixelatetool.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tools/pixelate/pixelatetool.cpp b/src/tools/pixelate/pixelatetool.cpp index 47831d20..e9ce8a82 100644 --- a/src/tools/pixelate/pixelatetool.cpp +++ b/src/tools/pixelate/pixelatetool.cpp @@ -87,10 +87,12 @@ void PixelateTool::process(QPainter& painter, scene.render(&painter, selection, QRectF()); } else { int width = selection.width() * (0.5 / qMax(1, m_thickness)); + int height = selection.height() * (0.5 / qMax(1, m_thickness)); + QSize size = QSize(qMax(width, 1), qMax(height, 1)); QPixmap t = pixmap.copy(selection); - t = t.scaledToWidth(qMax(width, 1), Qt::SmoothTransformation); - t = t.scaledToWidth(selection.width()); + t = t.scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + t = t.scaled(selection.width(), selection.height()); painter.drawImage(selection, t.toImage()); } }