summaryrefslogtreecommitdiff
path: root/Userland/Applications/PixelPaint
diff options
context:
space:
mode:
authorMarcus Nilsson <brainbomb@gmail.com>2021-07-05 23:22:57 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-08 20:16:26 +0200
commit618bb2d33e8bcda6ef1ebb1bd6c0a196c35fba44 (patch)
tree5f983c811de8c1307fd1295adbe0c454416e22e8 /Userland/Applications/PixelPaint
parent9be08e33eae4d582695c605d2a076e96e3a783a9 (diff)
downloadserenity-618bb2d33e8bcda6ef1ebb1bd6c0a196c35fba44.zip
PixelPaint: Make brush draw on mousedown
This makes the brush tool start drawing a point before the user moves the mouse, like in Photoshop and Gimp. The number of iterations of draw_point makes for roughly 4 clicks to full opacity.
Diffstat (limited to 'Userland/Applications/PixelPaint')
-rw-r--r--Userland/Applications/PixelPaint/BrushTool.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/Userland/Applications/PixelPaint/BrushTool.cpp b/Userland/Applications/PixelPaint/BrushTool.cpp
index dea6e3da4a..f918efe2e0 100644
--- a/Userland/Applications/PixelPaint/BrushTool.cpp
+++ b/Userland/Applications/PixelPaint/BrushTool.cpp
@@ -25,11 +25,17 @@ BrushTool::~BrushTool()
{
}
-void BrushTool::on_mousedown(Layer&, GUI::MouseEvent& event, GUI::MouseEvent&)
+void BrushTool::on_mousedown(Layer& layer, GUI::MouseEvent& event, GUI::MouseEvent&)
{
if (event.button() != GUI::MouseButton::Left && event.button() != GUI::MouseButton::Right)
return;
+ const int first_draw_opacity = 10;
+
+ for (int i = 0; i < first_draw_opacity; ++i)
+ draw_point(layer.bitmap(), m_editor->color_for(event), event.position());
+
+ layer.did_modify_bitmap();
m_last_position = event.position();
}