Fix pixelation of small areas

This commit is contained in:
Ash Holland
2020-10-10 14:24:33 +01:00
committed by borgmanJeremy
parent c5b6fe3957
commit c8767e7a1b

View File

@@ -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());
}
}