1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 14:37:45 +00:00

PixelPaint: Move "marching ants" painting logic to ImageEditor

Since this code needs to look at a bunch of ImageEditor state anyway,
it makes more sense for it to live in ImageEditor.
This commit is contained in:
Andreas Kling 2022-08-25 20:42:56 +02:00
parent e6d860f2fe
commit 67596d9546
5 changed files with 116 additions and 108 deletions

View file

@ -40,22 +40,17 @@ public:
[[nodiscard]] u8 get_selection_alpha(int x, int y) const { return m_mask.get(x, y); }
[[nodiscard]] u8 get_selection_alpha(Gfx::IntPoint const& point) const { return get_selection_alpha(point.x(), point.y()); }
void paint(Gfx::Painter&);
void draw_marching_ants(Gfx::Painter&, Gfx::IntRect const&) const;
void draw_marching_ants(Gfx::Painter&, Mask const&) const;
Mask const& mask() const { return m_mask; }
void begin_interactive_selection() { m_in_interactive_selection = true; }
void end_interactive_selection() { m_in_interactive_selection = false; }
bool in_interactive_selection() { return m_in_interactive_selection; }
private:
ImageEditor& m_editor;
Mask m_mask;
RefPtr<Core::Timer> m_marching_ants_timer;
int m_marching_ants_offset { 0 };
bool m_in_interactive_selection { false };
void draw_marching_ants_pixel(Gfx::Painter&, int x, int y) const;
};
}