diff options
author | Mustafa Quraish <mustafaq9@gmail.com> | 2021-09-06 20:48:36 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-07 16:53:40 +0200 |
commit | d6348e1b322152e6a803a906281fd467b5dbe31b (patch) | |
tree | 0ba1a3f29b801235b933099723a9c21b21d72107 /Userland/Applications/PixelPaint | |
parent | 603d3a5dc61886df348040654a61b357d50ac5fd (diff) | |
download | serenity-d6348e1b322152e6a803a906281fd467b5dbe31b.zip |
PixelPaint: Use correct thickness in `RectangleTool::on_second_paint()`
Previously, we were ignoring the scale of the editor in the second
paint step. If you were zoomed in, the size while you were drawing
was not the same as the size of the final shape.
Diffstat (limited to 'Userland/Applications/PixelPaint')
-rw-r--r-- | Userland/Applications/PixelPaint/RectangleTool.cpp | 6 | ||||
-rw-r--r-- | Userland/Applications/PixelPaint/RectangleTool.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Applications/PixelPaint/RectangleTool.cpp b/Userland/Applications/PixelPaint/RectangleTool.cpp index 19592fb694..fdab706dd9 100644 --- a/Userland/Applications/PixelPaint/RectangleTool.cpp +++ b/Userland/Applications/PixelPaint/RectangleTool.cpp @@ -27,7 +27,7 @@ RectangleTool::~RectangleTool() { } -void RectangleTool::draw_using(GUI::Painter& painter, Gfx::IntPoint const& start_position, Gfx::IntPoint const& end_position) +void RectangleTool::draw_using(GUI::Painter& painter, Gfx::IntPoint const& start_position, Gfx::IntPoint const& end_position, int thickness) { Gfx::IntRect rect; if (m_draw_mode == DrawMode::FromCenter) { @@ -42,7 +42,7 @@ void RectangleTool::draw_using(GUI::Painter& painter, Gfx::IntPoint const& start painter.fill_rect(rect, m_editor->color_for(m_drawing_button)); break; case FillMode::Outline: - painter.draw_rect_with_thickness(rect, m_editor->color_for(m_drawing_button), m_thickness); + painter.draw_rect_with_thickness(rect, m_editor->color_for(m_drawing_button), thickness); break; case FillMode::Gradient: painter.fill_rect_with_gradient(rect, m_editor->primary_color(), m_editor->secondary_color()); @@ -77,7 +77,7 @@ void RectangleTool::on_mouseup(Layer* layer, MouseEvent& event) if (event.layer_event().button() == m_drawing_button) { GUI::Painter painter(layer->bitmap()); - draw_using(painter, m_rectangle_start_position, m_rectangle_end_position); + draw_using(painter, m_rectangle_start_position, m_rectangle_end_position, m_thickness); m_drawing_button = GUI::MouseButton::None; layer->did_modify_bitmap(); m_editor->did_complete_action(); diff --git a/Userland/Applications/PixelPaint/RectangleTool.h b/Userland/Applications/PixelPaint/RectangleTool.h index c74ceed66e..2cd7820f6c 100644 --- a/Userland/Applications/PixelPaint/RectangleTool.h +++ b/Userland/Applications/PixelPaint/RectangleTool.h @@ -38,7 +38,7 @@ private: FromCorner, }; - void draw_using(GUI::Painter&, Gfx::IntPoint const& start_position, Gfx::IntPoint const& end_position); + void draw_using(GUI::Painter&, Gfx::IntPoint const& start_position, Gfx::IntPoint const& end_position, int thickness); RefPtr<GUI::Widget> m_properties_widget; GUI::MouseButton m_drawing_button { GUI::MouseButton::None }; |