LibGUI: Create thumnail for gif files
This commit is contained in:
parent
e7b9e03285
commit
c9c1d1fae0
Notes:
sideshowbarker
2024-07-19 07:16:41 +09:00
Author: https://github.com/asliturk Commit: https://github.com/SerenityOS/serenity/commit/c9c1d1fae01 Pull-request: https://github.com/SerenityOS/serenity/pull/1956 Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/linusg
2 changed files with 8 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue