mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 20:59:16 +00:00
LibGUI: Use new Bitmap::is_path_a_supported_image_format method
This commit is contained in:
parent
3a903babee
commit
0799835e15
Notes:
sideshowbarker
2024-07-19 05:37:57 +09:00
Author: https://github.com/asliturk
Commit: 0799835e15
Pull-request: https://github.com/SerenityOS/serenity/pull/2557
Reviewed-by: https://github.com/bugaevc
2 changed files with 2 additions and 2 deletions
|
@ -269,7 +269,7 @@ FilePicker::~FilePicker()
|
|||
|
||||
void FilePicker::set_preview(const LexicalPath& path)
|
||||
{
|
||||
if (path.has_extension(".png")) {
|
||||
if (Gfx::Bitmap::is_path_a_supported_image_format(path.string())) {
|
||||
auto bitmap = Gfx::Bitmap::load_from_file(path.string());
|
||||
if (!bitmap) {
|
||||
clear_preview();
|
||||
|
|
|
@ -460,7 +460,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") || node.name.to_lowercase().ends_with(".gif")) {
|
||||
if (Gfx::Bitmap::is_path_a_supported_image_format(node.name.to_lowercase())) {
|
||||
if (!node.thumbnail) {
|
||||
if (!const_cast<FileSystemModel*>(this)->fetch_thumbnail_for(node))
|
||||
return m_filetype_image_icon;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue