diff options
Diffstat (limited to 'Applications/PixelPaint')
-rw-r--r-- | Applications/PixelPaint/EllipseTool.cpp | 10 | ||||
-rw-r--r-- | Applications/PixelPaint/EllipseTool.h | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/Applications/PixelPaint/EllipseTool.cpp b/Applications/PixelPaint/EllipseTool.cpp index 91b03473cc..9a24c07745 100644 --- a/Applications/PixelPaint/EllipseTool.cpp +++ b/Applications/PixelPaint/EllipseTool.cpp @@ -43,9 +43,8 @@ EllipseTool::~EllipseTool() { } -void EllipseTool::draw_using(GUI::Painter& painter) +void EllipseTool::draw_using(GUI::Painter& painter, const Gfx::Rect& ellipse_intersecting_rect) { - auto ellipse_intersecting_rect = Gfx::Rect::from_two_points(m_ellipse_start_position, m_ellipse_end_position); switch (m_mode) { case Mode::Outline: painter.draw_ellipse_intersecting(ellipse_intersecting_rect, m_editor->color_for(m_drawing_button), m_thickness); @@ -73,7 +72,7 @@ void EllipseTool::on_mouseup(Layer& layer, GUI::MouseEvent& event, GUI::MouseEve { if (event.button() == m_drawing_button) { GUI::Painter painter(layer.bitmap()); - draw_using(painter); + draw_using(painter, Gfx::Rect::from_two_points(m_ellipse_start_position, m_ellipse_end_position)); m_drawing_button = GUI::MouseButton::None; m_editor->update(); } @@ -95,8 +94,9 @@ void EllipseTool::on_second_paint(const Layer& layer, GUI::PaintEvent& event) GUI::Painter painter(*m_editor); painter.add_clip_rect(event.rect()); - painter.translate(layer.location()); - draw_using(painter); + auto preview_start = m_editor->layer_position_to_editor_position(layer, m_ellipse_start_position).to_int_point(); + auto preview_end = m_editor->layer_position_to_editor_position(layer, m_ellipse_end_position).to_int_point(); + draw_using(painter, Gfx::Rect::from_two_points(preview_start, preview_end)); } void EllipseTool::on_keydown(GUI::KeyEvent& event) diff --git a/Applications/PixelPaint/EllipseTool.h b/Applications/PixelPaint/EllipseTool.h index 8bf2d7689e..8169bc2c8e 100644 --- a/Applications/PixelPaint/EllipseTool.h +++ b/Applications/PixelPaint/EllipseTool.h @@ -51,7 +51,7 @@ private: }; virtual const char* class_name() const override { return "EllipseTool"; } - void draw_using(GUI::Painter& painter); + void draw_using(GUI::Painter&, const Gfx::Rect&); GUI::MouseButton m_drawing_button { GUI::MouseButton::None }; Gfx::Point m_ellipse_start_position; |