summaryrefslogtreecommitdiff
path: root/Userland/Applications/PixelPaint/Selection.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-06-14 17:45:59 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-14 18:25:17 +0200
commit4cecd7900036554c7d153ca8b876bbc49b3bd31f (patch)
tree20b9597d09fcf4c682613d12253f99040245d118 /Userland/Applications/PixelPaint/Selection.h
parent1b897ec561f4731353a025ec028e1fbab7f335a2 (diff)
downloadserenity-4cecd7900036554c7d153ca8b876bbc49b3bd31f.zip
PixelPaint: Draw the current editor selection as marching ants
This patch moves the marching ants painting code to Selection and unifies the timer mechanism so that all marching ants are synchronized which looks neat. :^)
Diffstat (limited to 'Userland/Applications/PixelPaint/Selection.h')
-rw-r--r--Userland/Applications/PixelPaint/Selection.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/Userland/Applications/PixelPaint/Selection.h b/Userland/Applications/PixelPaint/Selection.h
index e852f07da4..1322a14563 100644
--- a/Userland/Applications/PixelPaint/Selection.h
+++ b/Userland/Applications/PixelPaint/Selection.h
@@ -6,6 +6,7 @@
#pragma once
+#include <LibCore/Timer.h>
#include <LibGfx/Rect.h>
namespace PixelPaint {
@@ -15,7 +16,7 @@ class ImageEditor;
// Coordinates are image-relative.
class Selection {
public:
- Selection() { }
+ explicit Selection(ImageEditor&);
bool is_empty() const { return m_rect.is_empty(); }
void clear() { m_rect = {}; }
@@ -23,8 +24,13 @@ public:
void paint(Gfx::Painter&, ImageEditor const&);
+ void draw_marching_ants(Gfx::Painter&, Gfx::IntRect const&) const;
+
private:
+ ImageEditor& m_editor;
Gfx::IntRect m_rect;
+ RefPtr<Core::Timer> m_marching_ants_timer;
+ int m_marching_ants_offset { 0 };
};
}