mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 17:58:18 +03:00
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:
parent
9c0c677d57
commit
93e9c2732b
Notes:
sideshowbarker
2024-07-19 09:19:40 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/93e9c2732b1
@ -71,14 +71,6 @@ RefPtr<Bitmap> Bitmap::load_from_file(const StringView& path)
|
|||||||
return load_png(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)
|
Bitmap::Bitmap(BitmapFormat format, const Size& size, size_t pitch, RGBA32* data)
|
||||||
: m_size(size)
|
: m_size(size)
|
||||||
, m_data(data)
|
, m_data(data)
|
||||||
@ -89,16 +81,6 @@ Bitmap::Bitmap(BitmapFormat format, const Size& size, size_t pitch, RGBA32* data
|
|||||||
m_palette = new RGBA32[256];
|
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)
|
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));
|
return adopt(*new Bitmap(format, move(shared_buffer), size));
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/Forward.h>
|
#include <AK/Forward.h>
|
||||||
#include <AK/MappedFile.h>
|
|
||||||
#include <AK/RefCounted.h>
|
#include <AK/RefCounted.h>
|
||||||
#include <AK/RefPtr.h>
|
#include <AK/RefPtr.h>
|
||||||
#include <LibGfx/Color.h>
|
#include <LibGfx/Color.h>
|
||||||
@ -48,7 +47,6 @@ public:
|
|||||||
static NonnullRefPtr<Bitmap> create_purgeable(BitmapFormat, const Size&);
|
static NonnullRefPtr<Bitmap> create_purgeable(BitmapFormat, const Size&);
|
||||||
static NonnullRefPtr<Bitmap> create_wrapper(BitmapFormat, const Size&, size_t pitch, RGBA32*);
|
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(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&);
|
static NonnullRefPtr<Bitmap> create_with_shared_buffer(BitmapFormat, NonnullRefPtr<SharedBuffer>&&, const Size&);
|
||||||
|
|
||||||
NonnullRefPtr<Bitmap> to_shareable_bitmap() const;
|
NonnullRefPtr<Bitmap> to_shareable_bitmap() const;
|
||||||
@ -138,7 +136,6 @@ private:
|
|||||||
Yes };
|
Yes };
|
||||||
Bitmap(BitmapFormat, const Size&, Purgeable);
|
Bitmap(BitmapFormat, const Size&, Purgeable);
|
||||||
Bitmap(BitmapFormat, const Size&, size_t pitch, RGBA32*);
|
Bitmap(BitmapFormat, const Size&, size_t pitch, RGBA32*);
|
||||||
Bitmap(BitmapFormat, const Size&, MappedFile&&);
|
|
||||||
Bitmap(BitmapFormat, NonnullRefPtr<SharedBuffer>&&, const Size&);
|
Bitmap(BitmapFormat, NonnullRefPtr<SharedBuffer>&&, const Size&);
|
||||||
|
|
||||||
Size m_size;
|
Size m_size;
|
||||||
@ -149,7 +146,6 @@ private:
|
|||||||
bool m_needs_munmap { false };
|
bool m_needs_munmap { false };
|
||||||
bool m_purgeable { false };
|
bool m_purgeable { false };
|
||||||
bool m_volatile { false };
|
bool m_volatile { false };
|
||||||
MappedFile m_mapped_file;
|
|
||||||
RefPtr<SharedBuffer> m_shared_buffer;
|
RefPtr<SharedBuffer> m_shared_buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <AK/BufferStream.h>
|
#include <AK/BufferStream.h>
|
||||||
#include <AK/ByteBuffer.h>
|
#include <AK/ByteBuffer.h>
|
||||||
#include <AK/FileSystemPath.h>
|
#include <AK/FileSystemPath.h>
|
||||||
|
#include <AK/MappedFile.h>
|
||||||
#include <AK/NonnullOwnPtrVector.h>
|
#include <AK/NonnullOwnPtrVector.h>
|
||||||
#include <LibGfx/GIFLoader.h>
|
#include <LibGfx/GIFLoader.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user