1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:37:34 +00:00

AK: Rename RetainPtr => RefPtr and Retained => NonnullRefPtr.

This commit is contained in:
Andreas Kling 2019-06-21 18:37:47 +02:00
parent 77b9fa89dd
commit 90b1354688
188 changed files with 562 additions and 562 deletions

View file

@ -10,7 +10,7 @@ CharacterBitmap::~CharacterBitmap()
{
}
Retained<CharacterBitmap> CharacterBitmap::create_from_ascii(const char* asciiData, unsigned width, unsigned height)
NonnullRefPtr<CharacterBitmap> CharacterBitmap::create_from_ascii(const char* asciiData, unsigned width, unsigned height)
{
return adopt(*new CharacterBitmap(asciiData, width, height));
}

View file

@ -6,7 +6,7 @@
class CharacterBitmap : public RefCounted<CharacterBitmap> {
public:
static Retained<CharacterBitmap> create_from_ascii(const char* asciiData, unsigned width, unsigned height);
static NonnullRefPtr<CharacterBitmap> create_from_ascii(const char* asciiData, unsigned width, unsigned height);
~CharacterBitmap();
bool bit_at(unsigned x, unsigned y) const { return m_bits[y * width() + x] == '#'; }

View file

@ -53,7 +53,7 @@ Font& Font::default_bold_font()
return *s_default_bold_font;
}
RetainPtr<Font> Font::clone() const
RefPtr<Font> Font::clone() const
{
size_t bytes_per_glyph = sizeof(dword) * glyph_height();
// FIXME: This is leaked!
@ -93,7 +93,7 @@ Font::~Font()
{
}
RetainPtr<Font> Font::load_from_memory(const byte* data)
RefPtr<Font> Font::load_from_memory(const byte* data)
{
auto& header = *reinterpret_cast<const FontFileHeader*>(data);
if (memcmp(header.magic, "!Fnt", 4)) {
@ -114,7 +114,7 @@ RetainPtr<Font> Font::load_from_memory(const byte* data)
return adopt(*new Font(String(header.name), rows, widths, !header.is_variable_width, header.glyph_width, header.glyph_height));
}
RetainPtr<Font> Font::load_from_file(const StringView& path)
RefPtr<Font> Font::load_from_file(const StringView& path)
{
MappedFile mapped_file(path);
if (!mapped_file.is_valid())

View file

@ -47,9 +47,9 @@ public:
static Font& default_fixed_width_font();
RetainPtr<Font> clone() const;
RefPtr<Font> clone() const;
static RetainPtr<Font> load_from_file(const StringView& path);
static RefPtr<Font> load_from_file(const StringView& path);
bool write_to_file(const StringView& path);
~Font();
@ -78,7 +78,7 @@ public:
private:
Font(const StringView& name, unsigned* rows, byte* widths, bool is_fixed_width, byte glyph_width, byte glyph_height);
static RetainPtr<Font> load_from_memory(const byte*);
static RefPtr<Font> load_from_memory(const byte*);
String m_name;

View file

@ -7,7 +7,7 @@
#include <sys/mman.h>
#include <unistd.h>
Retained<GraphicsBitmap> GraphicsBitmap::create(Format format, const Size& size)
NonnullRefPtr<GraphicsBitmap> GraphicsBitmap::create(Format format, const Size& size)
{
return adopt(*new GraphicsBitmap(format, size));
}
@ -24,17 +24,17 @@ GraphicsBitmap::GraphicsBitmap(Format format, const Size& size)
m_needs_munmap = true;
}
Retained<GraphicsBitmap> GraphicsBitmap::create_wrapper(Format format, const Size& size, RGBA32* data)
NonnullRefPtr<GraphicsBitmap> GraphicsBitmap::create_wrapper(Format format, const Size& size, RGBA32* data)
{
return adopt(*new GraphicsBitmap(format, size, data));
}
RetainPtr<GraphicsBitmap> GraphicsBitmap::load_from_file(const StringView& path)
RefPtr<GraphicsBitmap> GraphicsBitmap::load_from_file(const StringView& path)
{
return load_png(path);
}
RetainPtr<GraphicsBitmap> GraphicsBitmap::load_from_file(Format format, const StringView& path, const Size& size)
RefPtr<GraphicsBitmap> GraphicsBitmap::load_from_file(Format format, const StringView& path, const Size& size)
{
MappedFile mapped_file(path);
if (!mapped_file.is_valid())
@ -61,12 +61,12 @@ GraphicsBitmap::GraphicsBitmap(Format format, const Size& size, MappedFile&& map
ASSERT(format != Format::Indexed8);
}
Retained<GraphicsBitmap> GraphicsBitmap::create_with_shared_buffer(Format format, Retained<SharedBuffer>&& shared_buffer, const Size& size)
NonnullRefPtr<GraphicsBitmap> GraphicsBitmap::create_with_shared_buffer(Format format, NonnullRefPtr<SharedBuffer>&& shared_buffer, const Size& size)
{
return adopt(*new GraphicsBitmap(format, move(shared_buffer), size));
}
GraphicsBitmap::GraphicsBitmap(Format format, Retained<SharedBuffer>&& shared_buffer, const Size& size)
GraphicsBitmap::GraphicsBitmap(Format format, NonnullRefPtr<SharedBuffer>&& shared_buffer, const Size& size)
: m_size(size)
, m_data((RGBA32*)shared_buffer->data())
, m_pitch(round_up_to_power_of_two(size.width() * sizeof(RGBA32), 16))

View file

@ -19,11 +19,11 @@ public:
Indexed8
};
static Retained<GraphicsBitmap> create(Format, const Size&);
static Retained<GraphicsBitmap> create_wrapper(Format, const Size&, RGBA32*);
static RetainPtr<GraphicsBitmap> load_from_file(const StringView& path);
static RetainPtr<GraphicsBitmap> load_from_file(Format, const StringView& path, const Size&);
static Retained<GraphicsBitmap> create_with_shared_buffer(Format, Retained<SharedBuffer>&&, const Size&);
static NonnullRefPtr<GraphicsBitmap> create(Format, const Size&);
static NonnullRefPtr<GraphicsBitmap> create_wrapper(Format, const Size&, RGBA32*);
static RefPtr<GraphicsBitmap> load_from_file(const StringView& path);
static RefPtr<GraphicsBitmap> load_from_file(Format, const StringView& path, const Size&);
static NonnullRefPtr<GraphicsBitmap> create_with_shared_buffer(Format, NonnullRefPtr<SharedBuffer>&&, const Size&);
~GraphicsBitmap();
RGBA32* scanline(int y);
@ -81,7 +81,7 @@ private:
GraphicsBitmap(Format, const Size&);
GraphicsBitmap(Format, const Size&, RGBA32*);
GraphicsBitmap(Format, const Size&, MappedFile&&);
GraphicsBitmap(Format, Retained<SharedBuffer>&&, const Size&);
GraphicsBitmap(Format, NonnullRefPtr<SharedBuffer>&&, const Size&);
Size m_size;
RGBA32* m_data { nullptr };
@ -90,7 +90,7 @@ private:
Format m_format { Format::Invalid };
bool m_needs_munmap { false };
MappedFile m_mapped_file;
RetainPtr<SharedBuffer> m_shared_buffer;
RefPtr<SharedBuffer> m_shared_buffer;
};
inline RGBA32* GraphicsBitmap::scanline(int y)

View file

@ -42,7 +42,7 @@ struct PNGLoadingContext {
bool has_seen_zlib_header { false };
bool has_alpha() const { return color_type & 4; }
Vector<Scanline> scanlines;
RetainPtr<GraphicsBitmap> bitmap;
RefPtr<GraphicsBitmap> bitmap;
byte* decompression_buffer { nullptr };
int decompression_buffer_size { 0 };
Vector<byte> compressed_data;
@ -98,10 +98,10 @@ private:
int m_size_remaining;
};
static RetainPtr<GraphicsBitmap> load_png_impl(const byte*, int);
static RefPtr<GraphicsBitmap> load_png_impl(const byte*, int);
static bool process_chunk(Streamer&, PNGLoadingContext& context);
RetainPtr<GraphicsBitmap> load_png(const StringView& path)
RefPtr<GraphicsBitmap> load_png(const StringView& path)
{
MappedFile mapped_file(path);
if (!mapped_file.is_valid())
@ -302,7 +302,7 @@ template<bool has_alpha, byte filter_type>
}
}
static RetainPtr<GraphicsBitmap> load_png_impl(const byte* data, int data_size)
static RefPtr<GraphicsBitmap> load_png_impl(const byte* data, int data_size)
{
#ifdef PNG_STOPWATCH_DEBUG
Stopwatch sw("load_png_impl: total");

View file

@ -2,4 +2,4 @@
#include <SharedGraphics/GraphicsBitmap.h>
RetainPtr<GraphicsBitmap> load_png(const StringView& path);
RefPtr<GraphicsBitmap> load_png(const StringView& path);

View file

@ -80,7 +80,7 @@ protected:
const State& state() const { return m_state_stack.last(); }
Rect m_clip_origin;
Retained<GraphicsBitmap> m_target;
NonnullRefPtr<GraphicsBitmap> m_target;
Vector<State, 4> m_state_stack;
};