draw rounded selection using thickness radius instead of drawing simple selection

This commit is contained in:
Eric Blanquer
2020-06-24 00:27:57 +02:00
committed by borgmanJeremy
parent b1edf99be1
commit 1bc2bfe2a4

View File

@@ -65,8 +65,13 @@ void SelectionTool::process(QPainter& painter,
if (recordUndo) {
updateBackup(pixmap);
}
painter.setPen(QPen(m_color, m_thickness));
painter.drawRect(QRect(m_points.first, m_points.second));
painter.setPen(QPen(m_color, PADDING_VALUE + m_thickness));
if (m_thickness == 0) {
painter.drawRect(QRect(m_points.first, m_points.second));
}
else {
painter.drawRoundedRect(QRect(m_points.first, m_points.second), m_thickness, m_thickness);
}
}
void SelectionTool::paintMousePreview(QPainter& painter,
@@ -79,7 +84,7 @@ void SelectionTool::paintMousePreview(QPainter& painter,
void SelectionTool::drawStart(const CaptureContext& context)
{
m_color = context.color;
m_thickness = context.thickness + PADDING_VALUE;
m_thickness = context.thickness;
m_points.first = context.mousePos;
m_points.second = context.mousePos;
}