From c9c1d1fae01deb1542dbabb2156355c98f704876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=BCseyin=20ASLIT=C3=9CRK?= Date: Sun, 26 Apr 2020 00:05:28 +0300 Subject: LibGUI: Create thumnail for gif files --- Libraries/LibGUI/FileSystemModel.cpp | 2 +- Libraries/LibGfx/Bitmap.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Libraries/LibGUI/FileSystemModel.cpp b/Libraries/LibGUI/FileSystemModel.cpp index 5d1deb036c..b92c942d5f 100644 --- a/Libraries/LibGUI/FileSystemModel.cpp +++ b/Libraries/LibGUI/FileSystemModel.cpp @@ -440,7 +440,7 @@ Icon FileSystemModel::icon_for_file(const mode_t mode, const String& name) const Icon FileSystemModel::icon_for(const Node& node) const { - if (node.name.to_lowercase().ends_with(".png")) { + if (node.name.to_lowercase().ends_with(".png") || node.name.to_lowercase().ends_with(".gif")) { if (!node.thumbnail) { if (!const_cast(this)->fetch_thumbnail_for(node)) return m_filetype_image_icon; diff --git a/Libraries/LibGfx/Bitmap.cpp b/Libraries/LibGfx/Bitmap.cpp index e7a467a177..d254b60dae 100644 --- a/Libraries/LibGfx/Bitmap.cpp +++ b/Libraries/LibGfx/Bitmap.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -85,7 +86,12 @@ RefPtr Bitmap::create_wrapper(BitmapFormat format, const Size& size, siz RefPtr Bitmap::load_from_file(const StringView& path) { - return load_png(path); + if(path.ends_with(".png")) + return load_png(path); + if(path.ends_with(".gif")) + return load_gif(path); + + return nullptr; } Bitmap::Bitmap(BitmapFormat format, const Size& size, size_t pitch, RGBA32* data) -- cgit v1.2.3