LibGfx: Remove unused Bitmap::load_from_file() for loading raw RGBA

This was not used anywhere but added unnecessary members to Bitmap.
This commit is contained in:
Andreas Kling 2020-02-15 01:06:32 +01:00
parent 9c0c677d57
commit 93e9c2732b
Notes: sideshowbarker 2024-07-19 09:19:40 +09:00
3 changed files with 1 additions and 22 deletions

View File

@ -71,14 +71,6 @@ RefPtr<Bitmap> Bitmap::load_from_file(const StringView& path)
return load_png(path);
}
RefPtr<Bitmap> Bitmap::load_from_file(BitmapFormat format, const StringView& path, const Size& size)
{
MappedFile mapped_file(path);
if (!mapped_file.is_valid())
return nullptr;
return adopt(*new Bitmap(format, size, move(mapped_file)));
}
Bitmap::Bitmap(BitmapFormat format, const Size& size, size_t pitch, RGBA32* data)
: m_size(size)
, m_data(data)
@ -89,16 +81,6 @@ Bitmap::Bitmap(BitmapFormat format, const Size& size, size_t pitch, RGBA32* data
m_palette = new RGBA32[256];
}
Bitmap::Bitmap(BitmapFormat format, const Size& size, MappedFile&& mapped_file)
: m_size(size)
, m_data((RGBA32*)mapped_file.data())
, m_pitch(round_up_to_power_of_two(size.width() * sizeof(RGBA32), 16))
, m_format(format)
, m_mapped_file(move(mapped_file))
{
ASSERT(format != BitmapFormat::Indexed8);
}
NonnullRefPtr<Bitmap> Bitmap::create_with_shared_buffer(BitmapFormat format, NonnullRefPtr<SharedBuffer>&& shared_buffer, const Size& size)
{
return adopt(*new Bitmap(format, move(shared_buffer), size));

View File

@ -27,7 +27,6 @@
#pragma once
#include <AK/Forward.h>
#include <AK/MappedFile.h>
#include <AK/RefCounted.h>
#include <AK/RefPtr.h>
#include <LibGfx/Color.h>
@ -48,7 +47,6 @@ public:
static NonnullRefPtr<Bitmap> create_purgeable(BitmapFormat, const Size&);
static NonnullRefPtr<Bitmap> create_wrapper(BitmapFormat, const Size&, size_t pitch, RGBA32*);
static RefPtr<Bitmap> load_from_file(const StringView& path);
static RefPtr<Bitmap> load_from_file(BitmapFormat, const StringView& path, const Size&);
static NonnullRefPtr<Bitmap> create_with_shared_buffer(BitmapFormat, NonnullRefPtr<SharedBuffer>&&, const Size&);
NonnullRefPtr<Bitmap> to_shareable_bitmap() const;
@ -138,7 +136,6 @@ private:
Yes };
Bitmap(BitmapFormat, const Size&, Purgeable);
Bitmap(BitmapFormat, const Size&, size_t pitch, RGBA32*);
Bitmap(BitmapFormat, const Size&, MappedFile&&);
Bitmap(BitmapFormat, NonnullRefPtr<SharedBuffer>&&, const Size&);
Size m_size;
@ -149,7 +146,6 @@ private:
bool m_needs_munmap { false };
bool m_purgeable { false };
bool m_volatile { false };
MappedFile m_mapped_file;
RefPtr<SharedBuffer> m_shared_buffer;
};

View File

@ -27,6 +27,7 @@
#include <AK/BufferStream.h>
#include <AK/ByteBuffer.h>
#include <AK/FileSystemPath.h>
#include <AK/MappedFile.h>
#include <AK/NonnullOwnPtrVector.h>
#include <LibGfx/GIFLoader.h>
#include <stdio.h>