1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:28:12 +00:00

QuickShow: Animate animated images :^)

With a little help (read: copy & paste) from ImageWidget, QuickShow will
now cycle through the frames of animated images - enjoy the cat GIFs!

Future improvement: cache decoded images like LibWeb's ImageResource to
waste less CPU - the same applies to LibGUI though, maybe we can put
something shared in LibGfx.

Closes #5837.
This commit is contained in:
Linus Groh 2021-03-16 23:37:44 +01:00 committed by Andreas Kling
parent 41e5155467
commit 10843a2c8c
3 changed files with 68 additions and 9 deletions

View file

@ -71,6 +71,7 @@ void ImageWidget::set_auto_resize(bool value)
set_fixed_size(m_bitmap->size());
}
// Same as QSWidget::animate(), you probably want to keep any changes in sync
void ImageWidget::animate()
{
m_current_frame_index = (m_current_frame_index + 1) % m_image_decoder->frame_count();