1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 00:17:46 +00:00

PixelPaint: Alternate selection outline between black and white

This commit is contained in:
Mateusz Górzyński 2021-06-15 14:22:34 +02:00 committed by Andreas Kling
parent 7597cca5c6
commit 4aff4249aa

View file

@ -22,7 +22,7 @@ Selection::Selection(ImageEditor& editor)
{
m_marching_ants_timer = Core::Timer::create_repeating(80, [this] {
++m_marching_ants_offset;
m_marching_ants_offset %= marching_ant_length;
m_marching_ants_offset %= (marching_ant_length * 2);
if (!is_empty() || m_in_interactive_selection)
m_editor.update();
});
@ -34,8 +34,11 @@ void Selection::draw_marching_ants(Gfx::Painter& painter, Gfx::IntRect const& re
int offset = m_marching_ants_offset;
auto draw_pixel = [&](int x, int y) {
if ((offset % marching_ant_length) != 0)
if ((offset % (marching_ant_length * 2)) < marching_ant_length) {
painter.set_pixel(x, y, Color::Black);
} else {
painter.set_pixel(x, y, Color::White);
}
offset++;
};