summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHüseyin ASLITÜRK <asliturk@hotmail.com>2020-04-26 00:05:28 +0300
committerAndreas Kling <kling@serenityos.org>2020-04-26 18:44:20 +0200
commitc9c1d1fae01deb1542dbabb2156355c98f704876 (patch)
treeb7f19eb272b2fbfbdf970f71dcf81fd1caf75459
parente7b9e03285128a0186693873dc1ebc5a0f85163d (diff)
downloadserenity-c9c1d1fae01deb1542dbabb2156355c98f704876.zip
LibGUI: Create thumnail for gif files
-rw-r--r--Libraries/LibGUI/FileSystemModel.cpp2
-rw-r--r--Libraries/LibGfx/Bitmap.cpp8
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<FileSystemModel*>(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 <AK/String.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/PNGLoader.h>
+#include <LibGfx/GIFLoader.h>
#include <LibGfx/ShareableBitmap.h>
#include <errno.h>
#include <fcntl.h>
@@ -85,7 +86,12 @@ RefPtr<Bitmap> Bitmap::create_wrapper(BitmapFormat format, const Size& size, siz
RefPtr<Bitmap> 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)