diff options
author | Linus Groh <mail@linusgroh.de> | 2020-11-13 00:25:27 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-11-14 10:11:26 +0100 |
commit | 5b68ea8dde12a6ff6f77d22ddfd24ebe50147e8a (patch) | |
tree | 038f5520024b26c5212a9d9f9eea4b74dbebdde7 /Libraries/LibGfx | |
parent | d3ee3fc68a67403940c22ad7ce20a9fb514e603f (diff) | |
download | serenity-5b68ea8dde12a6ff6f77d22ddfd24ebe50147e8a.zip |
LibGfx: Make Bitmap path handling case insensitive
Bitmap::is_path_a_supported_image_format() and Bitmap::load_from_file()
now check the file extension with CaseSensitivity::CaseInsensitive.
This fixes a couple of inconsistencies, for example would
FileSystemModel::icon_for() recognize image files uppercase extensions
but couldn't create thumbnails for them (any attempt to create a bitmap
from such files would fail).
Diffstat (limited to 'Libraries/LibGfx')
-rw-r--r-- | Libraries/LibGfx/Bitmap.cpp | 4 | ||||
-rw-r--r-- | Libraries/LibGfx/Bitmap.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/Libraries/LibGfx/Bitmap.cpp b/Libraries/LibGfx/Bitmap.cpp index cd07ce0037..cc102d45c0 100644 --- a/Libraries/LibGfx/Bitmap.cpp +++ b/Libraries/LibGfx/Bitmap.cpp @@ -122,8 +122,8 @@ RefPtr<Bitmap> Bitmap::create_wrapper(BitmapFormat format, const IntSize& size, RefPtr<Bitmap> Bitmap::load_from_file(const StringView& path) { -#define __ENUMERATE_IMAGE_FORMAT(Name, Ext) \ - if (path.ends_with(Ext)) \ +#define __ENUMERATE_IMAGE_FORMAT(Name, Ext) \ + if (path.ends_with(Ext, CaseSensitivity::CaseInsensitive)) \ return load_##Name(path); ENUMERATE_IMAGE_FORMATS #undef __ENUMERATE_IMAGE_FORMAT diff --git a/Libraries/LibGfx/Bitmap.h b/Libraries/LibGfx/Bitmap.h index 493c3292f6..c1118784d8 100644 --- a/Libraries/LibGfx/Bitmap.h +++ b/Libraries/LibGfx/Bitmap.h @@ -97,8 +97,8 @@ public: static RefPtr<Bitmap> create_from_serialized_byte_buffer(ByteBuffer&& buffer); static bool is_path_a_supported_image_format(const StringView& path) { -#define __ENUMERATE_IMAGE_FORMAT(Name, Ext) \ - if (path.ends_with(Ext)) \ +#define __ENUMERATE_IMAGE_FORMAT(Name, Ext) \ + if (path.ends_with(Ext, CaseSensitivity::CaseInsensitive)) \ return true; ENUMERATE_IMAGE_FORMATS #undef __ENUMERATE_IMAGE_FORMAT |