Skip to content

Commit

Permalink
LibGfx: Remove unused Bitmap::load_from_file() for loading raw RGBA
Browse files Browse the repository at this point in the history
This was not used anywhere but added unnecessary members to Bitmap.
  • Loading branch information
awesomekling committed Feb 15, 2020
1 parent 9c0c677 commit 93e9c27
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 22 deletions.
18 changes: 0 additions & 18 deletions Libraries/LibGfx/Bitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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));
Expand Down
4 changes: 0 additions & 4 deletions Libraries/LibGfx/Bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -48,7 +47,6 @@ class Bitmap : public RefCounted<Bitmap> {
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;
Expand Down Expand Up @@ -138,7 +136,6 @@ class Bitmap : public RefCounted<Bitmap> {
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;
Expand All @@ -149,7 +146,6 @@ class Bitmap : public RefCounted<Bitmap> {
bool m_needs_munmap { false };
bool m_purgeable { false };
bool m_volatile { false };
MappedFile m_mapped_file;
RefPtr<SharedBuffer> m_shared_buffer;
};

Expand Down
1 change: 1 addition & 0 deletions Libraries/LibGfx/GIFLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 93e9c27

Please sign in to comment.