1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 17:37:47 +00:00

LibGfx: Rename RGBA32 => ARGB32

The ARGB32 typedef is used for 32-bit #AARRGGBB quadruplets. As such,
the name RGBA32 was misleading, so let's call it ARGB32 instead.

Since endianness is a thing, let's not encode any assumptions about byte
order in the name of this type. ARGB32 is basically a "machine word"
of color.
This commit is contained in:
Andreas Kling 2022-03-04 22:05:20 +01:00
parent 5c4bb03926
commit 5ace66a903
14 changed files with 84 additions and 84 deletions

View file

@ -672,8 +672,8 @@ void Compositor::flush(Screen& screen)
// a scale applied. But this routine accesses the backbuffer pixels directly, so it
// must work in physical coordinates.
auto scaled_rect = rect * screen.scale_factor();
Gfx::RGBA32* front_ptr = screen_data.m_front_bitmap->scanline(scaled_rect.y()) + scaled_rect.x();
Gfx::RGBA32* back_ptr = screen_data.m_back_bitmap->scanline(scaled_rect.y()) + scaled_rect.x();
Gfx::ARGB32* front_ptr = screen_data.m_front_bitmap->scanline(scaled_rect.y()) + scaled_rect.x();
Gfx::ARGB32* back_ptr = screen_data.m_back_bitmap->scanline(scaled_rect.y()) + scaled_rect.x();
size_t pitch = screen_data.m_back_bitmap->pitch();
// NOTE: The meaning of a flush depends on whether we can flip buffers or not.
@ -685,8 +685,8 @@ void Compositor::flush(Screen& screen)
// If flipping is not supported, flushing means that we copy the changed
// rects from the backing bitmap to the display framebuffer.
Gfx::RGBA32* to_ptr;
const Gfx::RGBA32* from_ptr;
Gfx::ARGB32* to_ptr;
const Gfx::ARGB32* from_ptr;
if (screen_data.m_screen_can_set_buffer) {
to_ptr = back_ptr;
@ -698,8 +698,8 @@ void Compositor::flush(Screen& screen)
for (int y = 0; y < scaled_rect.height(); ++y) {
fast_u32_copy(to_ptr, from_ptr, scaled_rect.width());
from_ptr = (const Gfx::RGBA32*)((const u8*)from_ptr + pitch);
to_ptr = (Gfx::RGBA32*)((u8*)to_ptr + pitch);
from_ptr = (const Gfx::ARGB32*)((const u8*)from_ptr + pitch);
to_ptr = (Gfx::ARGB32*)((u8*)to_ptr + pitch);
}
if (device_can_flush_buffers) {
// Whether or not we need to flush buffers, we need to at least track what we modified

View file

@ -342,7 +342,7 @@ bool Screen::set_resolution(bool initial)
VERIFY(rc == 0);
m_size_in_bytes = properties.buffer_length;
m_framebuffer = (Gfx::RGBA32*)mmap(nullptr, m_size_in_bytes, PROT_READ | PROT_WRITE, MAP_SHARED, m_framebuffer_fd, 0);
m_framebuffer = (Gfx::ARGB32*)mmap(nullptr, m_size_in_bytes, PROT_READ | PROT_WRITE, MAP_SHARED, m_framebuffer_fd, 0);
VERIFY(m_framebuffer && m_framebuffer != (void*)-1);
if (m_can_set_buffer) {

View file

@ -157,7 +157,7 @@ public:
int height() const { return m_virtual_rect.height(); }
int scale_factor() const { return screen_layout_info().scale_factor; }
Gfx::RGBA32* scanline(int buffer_index, int y);
Gfx::ARGB32* scanline(int buffer_index, int y);
Gfx::IntSize physical_size() const { return { physical_width(), physical_height() }; }
@ -204,7 +204,7 @@ private:
size_t m_size_in_bytes { 0 };
size_t m_back_buffer_offset { 0 };
Gfx::RGBA32* m_framebuffer { nullptr };
Gfx::ARGB32* m_framebuffer { nullptr };
bool m_can_set_buffer { false };
bool m_can_device_flush_buffers { true }; // If the device can't do it we revert to false
@ -215,9 +215,9 @@ private:
NonnullOwnPtr<CompositorScreenData> m_compositor_screen_data;
};
inline Gfx::RGBA32* Screen::scanline(int buffer_index, int y)
inline Gfx::ARGB32* Screen::scanline(int buffer_index, int y)
{
return reinterpret_cast<Gfx::RGBA32*>(((u8*)m_framebuffer) + buffer_offset(buffer_index) + (y * m_pitch));
return reinterpret_cast<Gfx::ARGB32*>(((u8*)m_framebuffer) + buffer_offset(buffer_index) + (y * m_pitch));
}
}