summaryrefslogtreecommitdiff
path: root/Userland/Applications/PixelPaint/RectangleSelectTool.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-06-14 17:36:18 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-14 18:25:17 +0200
commit1b897ec561f4731353a025ec028e1fbab7f335a2 (patch)
treed015885fe1a9465a99c7eab53cc80d71abbdff97 /Userland/Applications/PixelPaint/RectangleSelectTool.cpp
parent96b52f13e47a33321c13308c5b2b7690fad2d488 (diff)
downloadserenity-1b897ec561f4731353a025ec028e1fbab7f335a2.zip
PixelPaint: Add a Selection class (ImageEditor has a Selection)
This will represent a complex, region-based selection in the future. For now though, it's just a simple rectangle. :^)
Diffstat (limited to 'Userland/Applications/PixelPaint/RectangleSelectTool.cpp')
-rw-r--r--Userland/Applications/PixelPaint/RectangleSelectTool.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Applications/PixelPaint/RectangleSelectTool.cpp b/Userland/Applications/PixelPaint/RectangleSelectTool.cpp
index 6a9dc62e69..820bb4219f 100644
--- a/Userland/Applications/PixelPaint/RectangleSelectTool.cpp
+++ b/Userland/Applications/PixelPaint/RectangleSelectTool.cpp
@@ -58,6 +58,9 @@ void RectangleSelectTool::on_mouseup(Layer&, GUI::MouseEvent&, GUI::MouseEvent&
m_selecting = false;
m_editor->update();
+
+ auto rect_in_image = Gfx::IntRect::from_two_points(m_selection_start, m_selection_end);
+ m_editor->selection().set(rect_in_image);
}
void RectangleSelectTool::draw_marching_ants(Gfx::Painter& painter, Gfx::IntRect const& rect) const