diff options
Diffstat (limited to 'Userland/Libraries')
20 files changed, 2 insertions, 105 deletions
diff --git a/Userland/Libraries/LibGfx/BMPLoader.cpp b/Userland/Libraries/LibGfx/BMPLoader.cpp index 92e2326185..f244c3aff2 100644 --- a/Userland/Libraries/LibGfx/BMPLoader.cpp +++ b/Userland/Libraries/LibGfx/BMPLoader.cpp @@ -6,8 +6,7 @@ #include <AK/Debug.h> #include <AK/Function.h> -#include <AK/LexicalPath.h> -#include <AK/MappedFile.h> +#include <AK/Vector.h> #include <LibGfx/BMPLoader.h> namespace Gfx { @@ -166,14 +165,6 @@ struct BMPLoadingContext { static RefPtr<Bitmap> load_bmp_impl(const u8*, size_t); -RefPtr<Gfx::Bitmap> load_bmp(String const& path) -{ - auto file_or_error = MappedFile::map(path); - if (file_or_error.is_error()) - return nullptr; - return load_bmp_from_memory((u8 const*)file_or_error.value()->data(), file_or_error.value()->size(), LexicalPath::canonicalized_path(path)); -} - RefPtr<Gfx::Bitmap> load_bmp_from_memory(u8 const* data, size_t length, String const& mmap_name) { auto bitmap = load_bmp_impl(data, length); diff --git a/Userland/Libraries/LibGfx/BMPLoader.h b/Userland/Libraries/LibGfx/BMPLoader.h index 1503bc3680..ff6d6f4832 100644 --- a/Userland/Libraries/LibGfx/BMPLoader.h +++ b/Userland/Libraries/LibGfx/BMPLoader.h @@ -12,7 +12,6 @@ namespace Gfx { -RefPtr<Gfx::Bitmap> load_bmp(String const& path); RefPtr<Gfx::Bitmap> load_bmp_from_memory(u8 const*, size_t, String const& mmap_name = "<memory>"); struct BMPLoadingContext; diff --git a/Userland/Libraries/LibGfx/Bitmap.cpp b/Userland/Libraries/LibGfx/Bitmap.cpp index b0621577f0..f8db7fa4b1 100644 --- a/Userland/Libraries/LibGfx/Bitmap.cpp +++ b/Userland/Libraries/LibGfx/Bitmap.cpp @@ -6,6 +6,7 @@ #include <AK/Checked.h> #include <AK/LexicalPath.h> +#include <AK/MappedFile.h> #include <AK/Memory.h> #include <AK/MemoryStream.h> #include <AK/Optional.h> diff --git a/Userland/Libraries/LibGfx/DDSLoader.cpp b/Userland/Libraries/LibGfx/DDSLoader.cpp index d94165fd4a..bebd31fde9 100644 --- a/Userland/Libraries/LibGfx/DDSLoader.cpp +++ b/Userland/Libraries/LibGfx/DDSLoader.cpp @@ -6,8 +6,6 @@ #include <AK/Debug.h> #include <AK/Endian.h> -#include <AK/LexicalPath.h> -#include <AK/MappedFile.h> #include <AK/MemoryStream.h> #include <AK/StringBuilder.h> #include <AK/Vector.h> @@ -950,14 +948,6 @@ static RefPtr<Gfx::Bitmap> load_dds_impl(const u8* data, size_t length) return context.bitmap; } -RefPtr<Gfx::Bitmap> load_dds(String const& path) -{ - auto file_or_error = MappedFile::map(path); - if (file_or_error.is_error()) - return nullptr; - return load_dds_from_memory((u8 const*)file_or_error.value()->data(), file_or_error.value()->size(), LexicalPath::canonicalized_path(path)); -} - RefPtr<Gfx::Bitmap> load_dds_from_memory(u8 const* data, size_t length, String const& mmap_name) { auto bitmap = load_dds_impl(data, length); diff --git a/Userland/Libraries/LibGfx/DDSLoader.h b/Userland/Libraries/LibGfx/DDSLoader.h index 852f410473..73116a5b43 100644 --- a/Userland/Libraries/LibGfx/DDSLoader.h +++ b/Userland/Libraries/LibGfx/DDSLoader.h @@ -233,7 +233,6 @@ struct DDSHeaderDXT10 { u32 misc_flag2 {}; }; -RefPtr<Gfx::Bitmap> load_dds(String const& path); RefPtr<Gfx::Bitmap> load_dds_from_memory(u8 const*, size_t, String const& mmap_name = "<memory>"); struct DDSLoadingContext; diff --git a/Userland/Libraries/LibGfx/GIFLoader.cpp b/Userland/Libraries/LibGfx/GIFLoader.cpp index cfb6d68c98..497421a721 100644 --- a/Userland/Libraries/LibGfx/GIFLoader.cpp +++ b/Userland/Libraries/LibGfx/GIFLoader.cpp @@ -6,8 +6,6 @@ #include <AK/Array.h> #include <AK/Debug.h> -#include <AK/LexicalPath.h> -#include <AK/MappedFile.h> #include <AK/Math.h> #include <AK/Memory.h> #include <AK/MemoryStream.h> @@ -82,14 +80,6 @@ struct GIFLoadingContext { RefPtr<Gfx::Bitmap> prev_frame_buffer; }; -RefPtr<Gfx::Bitmap> load_gif(String const& path) -{ - auto file_or_error = MappedFile::map(path); - if (file_or_error.is_error()) - return nullptr; - return load_gif_from_memory((u8 const*)file_or_error.value()->data(), file_or_error.value()->size(), LexicalPath::canonicalized_path(path)); -} - RefPtr<Gfx::Bitmap> load_gif_from_memory(u8 const* data, size_t length, String const& mmap_name) { GIFImageDecoderPlugin gif_decoder(data, length); diff --git a/Userland/Libraries/LibGfx/GIFLoader.h b/Userland/Libraries/LibGfx/GIFLoader.h index 07eb4d6286..1487cd0302 100644 --- a/Userland/Libraries/LibGfx/GIFLoader.h +++ b/Userland/Libraries/LibGfx/GIFLoader.h @@ -12,7 +12,6 @@ namespace Gfx { -RefPtr<Gfx::Bitmap> load_gif(String const& path); RefPtr<Gfx::Bitmap> load_gif_from_memory(u8 const*, size_t, String const& mmap_name = "<memory>"); struct GIFLoadingContext; diff --git a/Userland/Libraries/LibGfx/ICOLoader.cpp b/Userland/Libraries/LibGfx/ICOLoader.cpp index dd4890c01c..ef92832344 100644 --- a/Userland/Libraries/LibGfx/ICOLoader.cpp +++ b/Userland/Libraries/LibGfx/ICOLoader.cpp @@ -6,8 +6,6 @@ #include <AK/ByteBuffer.h> #include <AK/Debug.h> -#include <AK/LexicalPath.h> -#include <AK/MappedFile.h> #include <AK/MemoryStream.h> #include <AK/NonnullOwnPtrVector.h> #include <AK/Types.h> @@ -91,14 +89,6 @@ struct ICOLoadingContext { size_t largest_index; }; -RefPtr<Gfx::Bitmap> load_ico(StringView path) -{ - auto file_or_error = MappedFile::map(path); - if (file_or_error.is_error()) - return nullptr; - return load_ico_from_memory((u8 const*)file_or_error.value()->data(), file_or_error.value()->size(), LexicalPath::canonicalized_path(path)); -} - RefPtr<Gfx::Bitmap> load_ico_from_memory(u8 const* data, size_t length, String const& mmap_name) { ICOImageDecoderPlugin decoder(data, length); diff --git a/Userland/Libraries/LibGfx/ICOLoader.h b/Userland/Libraries/LibGfx/ICOLoader.h index eb2b948c70..4487e86917 100644 --- a/Userland/Libraries/LibGfx/ICOLoader.h +++ b/Userland/Libraries/LibGfx/ICOLoader.h @@ -12,7 +12,6 @@ namespace Gfx { -RefPtr<Gfx::Bitmap> load_ico(StringView path); RefPtr<Gfx::Bitmap> load_ico_from_memory(u8 const*, size_t, String const& mmap_name = "<memory>"); struct ICOLoadingContext; diff --git a/Userland/Libraries/LibGfx/JPGLoader.cpp b/Userland/Libraries/LibGfx/JPGLoader.cpp index c064908b1d..914e8deaa8 100644 --- a/Userland/Libraries/LibGfx/JPGLoader.cpp +++ b/Userland/Libraries/LibGfx/JPGLoader.cpp @@ -8,7 +8,6 @@ #include <AK/ByteBuffer.h> #include <AK/Debug.h> #include <AK/HashMap.h> -#include <AK/LexicalPath.h> #include <AK/Math.h> #include <AK/MemoryStream.h> #include <AK/String.h> @@ -1235,14 +1234,6 @@ static RefPtr<Gfx::Bitmap> load_jpg_impl(const u8* data, size_t data_size) return context.bitmap; } -RefPtr<Gfx::Bitmap> load_jpg(String const& path) -{ - auto file_or_error = MappedFile::map(path); - if (file_or_error.is_error()) - return nullptr; - return load_jpg_from_memory((u8 const*)file_or_error.value()->data(), file_or_error.value()->size(), path); -} - RefPtr<Gfx::Bitmap> load_jpg_from_memory(u8 const* data, size_t length, String const& mmap_name) { auto bitmap = load_jpg_impl(data, length); diff --git a/Userland/Libraries/LibGfx/JPGLoader.h b/Userland/Libraries/LibGfx/JPGLoader.h index 04741fa978..284ae076f0 100644 --- a/Userland/Libraries/LibGfx/JPGLoader.h +++ b/Userland/Libraries/LibGfx/JPGLoader.h @@ -6,16 +6,11 @@ #pragma once -#include <AK/MappedFile.h> #include <AK/String.h> -#include <AK/Vector.h> -#include <LibGfx/Bitmap.h> #include <LibGfx/ImageDecoder.h> -#include <LibGfx/Size.h> namespace Gfx { -RefPtr<Gfx::Bitmap> load_jpg(String const& path); RefPtr<Gfx::Bitmap> load_jpg_from_memory(u8 const* data, size_t length, String const& mmap_name = "<memory>"); struct JPGLoadingContext; diff --git a/Userland/Libraries/LibGfx/PBMLoader.cpp b/Userland/Libraries/LibGfx/PBMLoader.cpp index 8373a076e9..242719abf0 100644 --- a/Userland/Libraries/LibGfx/PBMLoader.cpp +++ b/Userland/Libraries/LibGfx/PBMLoader.cpp @@ -8,9 +8,6 @@ #include "PortableImageLoaderCommon.h" #include "Streamer.h" #include <AK/Endian.h> -#include <AK/LexicalPath.h> -#include <AK/MappedFile.h> -#include <AK/StringBuilder.h> #include <string.h> namespace Gfx { @@ -97,11 +94,6 @@ static bool read_image_data(PBMLoadingContext& context, Streamer& streamer) return true; } -RefPtr<Gfx::Bitmap> load_pbm(StringView path) -{ - return load<PBMLoadingContext>(path); -} - RefPtr<Gfx::Bitmap> load_pbm_from_memory(u8 const* data, size_t length, String const& mmap_name) { return load_from_memory<PBMLoadingContext>(data, length, mmap_name); diff --git a/Userland/Libraries/LibGfx/PBMLoader.h b/Userland/Libraries/LibGfx/PBMLoader.h index 7520823b4d..ea15e46b48 100644 --- a/Userland/Libraries/LibGfx/PBMLoader.h +++ b/Userland/Libraries/LibGfx/PBMLoader.h @@ -7,12 +7,10 @@ #pragma once #include <AK/String.h> -#include <LibGfx/Bitmap.h> #include <LibGfx/ImageDecoder.h> namespace Gfx { -RefPtr<Gfx::Bitmap> load_pbm(StringView path); RefPtr<Gfx::Bitmap> load_pbm_from_memory(u8 const*, size_t, String const& mmap_name = "<memory>"); struct PBMLoadingContext; diff --git a/Userland/Libraries/LibGfx/PGMLoader.cpp b/Userland/Libraries/LibGfx/PGMLoader.cpp index eb04c31139..928892bbe7 100644 --- a/Userland/Libraries/LibGfx/PGMLoader.cpp +++ b/Userland/Libraries/LibGfx/PGMLoader.cpp @@ -8,8 +8,6 @@ #include "PortableImageLoaderCommon.h" #include "Streamer.h" #include <AK/Endian.h> -#include <AK/LexicalPath.h> -#include <AK/StringBuilder.h> #include <string.h> namespace Gfx { @@ -99,11 +97,6 @@ static bool read_image_data(PGMLoadingContext& context, Streamer& streamer) return true; } -RefPtr<Gfx::Bitmap> load_pgm(StringView path) -{ - return load<PGMLoadingContext>(path); -} - RefPtr<Gfx::Bitmap> load_pgm_from_memory(u8 const* data, size_t length, String const& mmap_name) { return load_from_memory<PGMLoadingContext>(data, length, mmap_name); diff --git a/Userland/Libraries/LibGfx/PGMLoader.h b/Userland/Libraries/LibGfx/PGMLoader.h index a64259a66a..019463fd16 100644 --- a/Userland/Libraries/LibGfx/PGMLoader.h +++ b/Userland/Libraries/LibGfx/PGMLoader.h @@ -12,7 +12,6 @@ namespace Gfx { -RefPtr<Gfx::Bitmap> load_pgm(StringView path); RefPtr<Gfx::Bitmap> load_pgm_from_memory(u8 const*, size_t, String const& mmap_name = "<memory>"); struct PGMLoadingContext; diff --git a/Userland/Libraries/LibGfx/PNGLoader.cpp b/Userland/Libraries/LibGfx/PNGLoader.cpp index d92cbaf0a3..990356de78 100644 --- a/Userland/Libraries/LibGfx/PNGLoader.cpp +++ b/Userland/Libraries/LibGfx/PNGLoader.cpp @@ -6,8 +6,6 @@ #include <AK/Debug.h> #include <AK/Endian.h> -#include <AK/LexicalPath.h> -#include <AK/MappedFile.h> #include <LibCompress/Zlib.h> #include <LibGfx/PNGLoader.h> #include <fcntl.h> @@ -169,14 +167,6 @@ private: static RefPtr<Gfx::Bitmap> load_png_impl(const u8*, size_t); static bool process_chunk(Streamer&, PNGLoadingContext& context); -RefPtr<Gfx::Bitmap> load_png(String const& path) -{ - auto file_or_error = MappedFile::map(path); - if (file_or_error.is_error()) - return nullptr; - return load_png_from_memory((u8 const*)file_or_error.value()->data(), file_or_error.value()->size(), LexicalPath::canonicalized_path(path)); -} - RefPtr<Gfx::Bitmap> load_png_from_memory(u8 const* data, size_t length, String const& mmap_name) { auto bitmap = load_png_impl(data, length); diff --git a/Userland/Libraries/LibGfx/PNGLoader.h b/Userland/Libraries/LibGfx/PNGLoader.h index 56b0860c3b..21c570c512 100644 --- a/Userland/Libraries/LibGfx/PNGLoader.h +++ b/Userland/Libraries/LibGfx/PNGLoader.h @@ -7,12 +7,10 @@ #pragma once #include <AK/String.h> -#include <LibGfx/Bitmap.h> #include <LibGfx/ImageDecoder.h> namespace Gfx { -RefPtr<Gfx::Bitmap> load_png(String const& path); RefPtr<Gfx::Bitmap> load_png_from_memory(u8 const*, size_t, String const& mmap_name = "<memory>"); struct PNGLoadingContext; diff --git a/Userland/Libraries/LibGfx/PPMLoader.cpp b/Userland/Libraries/LibGfx/PPMLoader.cpp index dc4c0fbdce..d647160f82 100644 --- a/Userland/Libraries/LibGfx/PPMLoader.cpp +++ b/Userland/Libraries/LibGfx/PPMLoader.cpp @@ -101,11 +101,6 @@ static bool read_image_data(PPMLoadingContext& context, Streamer& streamer) return true; } -RefPtr<Gfx::Bitmap> load_ppm(StringView path) -{ - return load<PPMLoadingContext>(path); -} - RefPtr<Gfx::Bitmap> load_ppm_from_memory(u8 const* data, size_t length, String const& mmap_name) { return load_from_memory<PPMLoadingContext>(data, length, mmap_name); diff --git a/Userland/Libraries/LibGfx/PPMLoader.h b/Userland/Libraries/LibGfx/PPMLoader.h index 82824a7d8f..bcbe7e90b8 100644 --- a/Userland/Libraries/LibGfx/PPMLoader.h +++ b/Userland/Libraries/LibGfx/PPMLoader.h @@ -12,7 +12,6 @@ namespace Gfx { -RefPtr<Gfx::Bitmap> load_ppm(StringView path); RefPtr<Gfx::Bitmap> load_ppm_from_memory(u8 const*, size_t, String const& mmap_name = "<memory>"); struct PPMLoadingContext; diff --git a/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h b/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h index fd901be4ac..7c9cfc75f3 100644 --- a/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h +++ b/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h @@ -10,8 +10,6 @@ #include <AK/Array.h> #include <AK/Debug.h> #include <AK/Endian.h> -#include <AK/LexicalPath.h> -#include <AK/MappedFile.h> #include <AK/ScopeGuard.h> #include <AK/String.h> #include <AK/StringBuilder.h> @@ -272,13 +270,4 @@ static RefPtr<Gfx::Bitmap> load_from_memory(u8 const* data, size_t length, Strin return bitmap; } -template<typename TContext> -static RefPtr<Gfx::Bitmap> load(StringView path) -{ - auto file_or_error = MappedFile::map(path); - if (file_or_error.is_error()) - return nullptr; - return load_from_memory<TContext>((u8 const*)file_or_error.value()->data(), file_or_error.value()->size(), LexicalPath::canonicalized_path(path)); -} - } |