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

Magnifier: Add timeline for easy checking of animations

This patch adds a 512 frame timeline to Magnifier and the ability to
step through it with the arrow keys.

This makes it easier to check Serenity animations frame by frame for
correctness etc.
This commit is contained in:
Junior Rantila 2021-12-15 14:26:47 +01:00 committed by Brian Gianforcaro
parent 58ec2f688b
commit 5238308d6f
3 changed files with 44 additions and 1 deletions

View file

@ -27,6 +27,22 @@ void MagnifierWidget::set_scale_factor(int scale_factor)
update();
}
void MagnifierWidget::display_previous_frame()
{
--m_frame_offset_from_head;
auto index = m_grabbed_bitmaps.head_index() + m_frame_offset_from_head;
m_grabbed_bitmap = m_grabbed_bitmaps.at(index);
update();
}
void MagnifierWidget::display_next_frame()
{
++m_frame_offset_from_head;
auto index = m_grabbed_bitmaps.head_index() + m_frame_offset_from_head;
m_grabbed_bitmap = m_grabbed_bitmaps.at(index);
update();
}
void MagnifierWidget::sync()
{
if (m_pause_capture)
@ -35,6 +51,7 @@ void MagnifierWidget::sync()
auto size = frame_inner_rect().size();
Gfx::IntSize grab_size { size.width() / m_scale_factor, size.height() / m_scale_factor };
m_grabbed_bitmap = GUI::WindowServerConnection::the().get_screen_bitmap_around_cursor(grab_size).bitmap();
m_grabbed_bitmaps.enqueue(m_grabbed_bitmap);
update();
}