mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:17:35 +00:00
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. :^)
This commit is contained in:
parent
1b897ec561
commit
4cecd79000
5 changed files with 51 additions and 46 deletions
|
@ -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 };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue