diff options
author | Linus Groh <mail@linusgroh.de> | 2021-03-16 23:31:15 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-17 12:37:48 +0100 |
commit | 41e51554679dcc72c235ac44f466c1d7f738fc40 (patch) | |
tree | c33b335901e3a9167af626ba7965e9c37f882994 | |
parent | 961137ea4c14747704c96715bb9f469d6f53bd8b (diff) | |
download | serenity-41e51554679dcc72c235ac44f466c1d7f738fc40.zip |
LibGUI: Animate any image in ImageWidget, not just *.gif
The image decoder already tells us whether the image is animated and it
can provide more than one frame, let's not put this behind an artificial
"file path must end with lowercase .gif" barrier.
-rw-r--r-- | Userland/Libraries/LibGUI/ImageWidget.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Userland/Libraries/LibGUI/ImageWidget.cpp b/Userland/Libraries/LibGUI/ImageWidget.cpp index deb6e94d68..218c09a809 100644 --- a/Userland/Libraries/LibGUI/ImageWidget.cpp +++ b/Userland/Libraries/LibGUI/ImageWidget.cpp @@ -103,13 +103,11 @@ void ImageWidget::load_from_file(const StringView& path) set_bitmap(bitmap); - if (path.ends_with(".gif")) { - if (m_image_decoder->is_animated() && m_image_decoder->frame_count() > 1) { - const auto& first_frame = m_image_decoder->frame(0); - m_timer->set_interval(first_frame.duration); - m_timer->on_timeout = [this] { animate(); }; - m_timer->start(); - } + if (m_image_decoder->is_animated() && m_image_decoder->frame_count() > 1) { + const auto& first_frame = m_image_decoder->frame(0); + m_timer->set_interval(first_frame.duration); + m_timer->on_timeout = [this] { animate(); }; + m_timer->start(); } } |