diff options
author | Andreas Kling <kling@serenityos.org> | 2022-03-04 22:05:20 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-04 23:40:21 +0100 |
commit | 5ace66a9037fa6968b417cfb604ae8419be62271 (patch) | |
tree | acc383f50bfab4f576af6f80b5dffee02a036883 /Userland | |
parent | 5c4bb039266242ee606aceabba5926831de46e83 (diff) | |
download | serenity-5ace66a9037fa6968b417cfb604ae8419be62271.zip |
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.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibGL/SoftwareGLContext.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Variant.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibGfx/Bitmap.cpp | 22 | ||||
-rw-r--r-- | Userland/Libraries/LibGfx/Bitmap.h | 22 | ||||
-rw-r--r-- | Userland/Libraries/LibGfx/Color.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibGfx/Color.h | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibGfx/GIFLoader.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibGfx/PNGLoader.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibGfx/Painter.cpp | 74 | ||||
-rw-r--r-- | Userland/Libraries/LibGfx/ShareableBitmap.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibGfx/SystemTheme.h | 2 | ||||
-rw-r--r-- | Userland/Services/WindowServer/Compositor.cpp | 12 | ||||
-rw-r--r-- | Userland/Services/WindowServer/Screen.cpp | 2 | ||||
-rw-r--r-- | Userland/Services/WindowServer/Screen.h | 8 |
14 files changed, 84 insertions, 84 deletions
diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.cpp b/Userland/Libraries/LibGL/SoftwareGLContext.cpp index d6424d67be..d544787881 100644 --- a/Userland/Libraries/LibGL/SoftwareGLContext.cpp +++ b/Userland/Libraries/LibGL/SoftwareGLContext.cpp @@ -1706,7 +1706,7 @@ void SoftwareGLContext::gl_read_pixels(GLint x, GLint y, GLsizei width, GLsizei char* out_ptr = reinterpret_cast<char*>(pixels); for (int i = 0; i < (int)height; ++i) { for (int j = 0; j < (int)width; ++j) { - Gfx::RGBA32 color {}; + Gfx::ARGB32 color {}; if (m_current_read_buffer == GL_FRONT || m_current_read_buffer == GL_LEFT || m_current_read_buffer == GL_FRONT_LEFT) { if (y + i >= m_frontbuffer->width() || x + j >= m_frontbuffer->height()) color = 0; diff --git a/Userland/Libraries/LibGUI/Variant.h b/Userland/Libraries/LibGUI/Variant.h index 2ad24d0a8d..ccdcd241d5 100644 --- a/Userland/Libraries/LibGUI/Variant.h +++ b/Userland/Libraries/LibGUI/Variant.h @@ -333,7 +333,7 @@ private: u32 as_u32; u64 as_u64; float as_float; - Gfx::RGBA32 as_color; + Gfx::ARGB32 as_color; Gfx::TextAlignment as_text_alignment; Gfx::ColorRole as_color_role; Gfx::AlignmentRole as_alignment_role; diff --git a/Userland/Libraries/LibGfx/Bitmap.cpp b/Userland/Libraries/LibGfx/Bitmap.cpp index 211acd229a..724d211618 100644 --- a/Userland/Libraries/LibGfx/Bitmap.cpp +++ b/Userland/Libraries/LibGfx/Bitmap.cpp @@ -175,7 +175,7 @@ static bool check_size(IntSize const& size, int scale_factor, BitmapFormat forma return true; } -ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_with_anonymous_buffer(BitmapFormat format, Core::AnonymousBuffer buffer, IntSize const& size, int scale_factor, Vector<RGBA32> const& palette) +ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_with_anonymous_buffer(BitmapFormat format, Core::AnonymousBuffer buffer, IntSize const& size, int scale_factor, Vector<ARGB32> const& palette) { if (size_would_overflow(format, size, scale_factor)) return Error::from_string_literal("Gfx::Bitmap::try_create_with_anonymous_buffer size overflow"); @@ -201,7 +201,7 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_from_serialized_byte_buffer(By unsigned scale_factor; BitmapFormat format; unsigned palette_size; - Vector<RGBA32> palette; + Vector<ARGB32> palette; auto read = [&]<typename T>(T& value) { if (stream.read({ &value, sizeof(T) }) != sizeof(T)) @@ -231,8 +231,8 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_from_serialized_byte_buffer(By auto bitmap = TRY(Bitmap::try_create(format, { width, height }, scale_factor)); - bitmap->m_palette = new RGBA32[palette_size]; - memcpy(bitmap->m_palette, palette.data(), palette_size * sizeof(RGBA32)); + bitmap->m_palette = new ARGB32[palette_size]; + memcpy(bitmap->m_palette, palette.data(), palette_size * sizeof(ARGB32)); data.copy_to({ bitmap->scanline(0), bitmap->size_in_bytes() }); return bitmap; @@ -241,7 +241,7 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_from_serialized_byte_buffer(By ByteBuffer Bitmap::serialize_to_byte_buffer() const { // FIXME: Somehow handle possible OOM situation here. - auto buffer = ByteBuffer::create_uninitialized(sizeof(size_t) + 4 * sizeof(unsigned) + sizeof(BitmapFormat) + sizeof(RGBA32) * palette_size(m_format) + size_in_bytes()).release_value_but_fixme_should_propagate_errors(); + auto buffer = ByteBuffer::create_uninitialized(sizeof(size_t) + 4 * sizeof(unsigned) + sizeof(BitmapFormat) + sizeof(ARGB32) * palette_size(m_format) + size_in_bytes()).release_value_but_fixme_should_propagate_errors(); OutputMemoryStream stream { buffer }; auto write = [&]<typename T>(T value) { @@ -268,7 +268,7 @@ ByteBuffer Bitmap::serialize_to_byte_buffer() const return buffer; } -Bitmap::Bitmap(BitmapFormat format, Core::AnonymousBuffer buffer, IntSize const& size, int scale_factor, Vector<RGBA32> const& palette) +Bitmap::Bitmap(BitmapFormat format, Core::AnonymousBuffer buffer, IntSize const& size, int scale_factor, Vector<ARGB32> const& palette) : m_size(size) , m_scale(scale_factor) , m_data(buffer.data<void>()) @@ -561,21 +561,21 @@ ErrorOr<BackingStore> Bitmap::allocate_backing_store(BitmapFormat format, IntSiz return BackingStore { data, pitch, data_size_in_bytes }; } -void Bitmap::allocate_palette_from_format(BitmapFormat format, Vector<RGBA32> const& source_palette) +void Bitmap::allocate_palette_from_format(BitmapFormat format, Vector<ARGB32> const& source_palette) { size_t size = palette_size(format); if (size == 0) return; - m_palette = new RGBA32[size]; + m_palette = new ARGB32[size]; if (!source_palette.is_empty()) { VERIFY(source_palette.size() == size); - memcpy(m_palette, source_palette.data(), size * sizeof(RGBA32)); + memcpy(m_palette, source_palette.data(), size * sizeof(ARGB32)); } } -Vector<RGBA32> Bitmap::palette_to_vector() const +Vector<ARGB32> Bitmap::palette_to_vector() const { - Vector<RGBA32> vector; + Vector<ARGB32> vector; auto size = palette_size(m_format); vector.ensure_capacity(size); for (size_t i = 0; i < size; ++i) diff --git a/Userland/Libraries/LibGfx/Bitmap.h b/Userland/Libraries/LibGfx/Bitmap.h index 7a1343c003..82d421b477 100644 --- a/Userland/Libraries/LibGfx/Bitmap.h +++ b/Userland/Libraries/LibGfx/Bitmap.h @@ -95,7 +95,7 @@ public: [[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> try_create_wrapper(BitmapFormat, IntSize const&, int intrinsic_scale, size_t pitch, void*); [[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> try_load_from_file(String const& path, int scale_factor = 1); [[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> try_load_from_fd_and_close(int fd, String const& path); - [[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> try_create_with_anonymous_buffer(BitmapFormat, Core::AnonymousBuffer, IntSize const&, int intrinsic_scale, Vector<RGBA32> const& palette); + [[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> try_create_with_anonymous_buffer(BitmapFormat, Core::AnonymousBuffer, IntSize const&, int intrinsic_scale, Vector<ARGB32> const& palette); static ErrorOr<NonnullRefPtr<Bitmap>> try_create_from_serialized_byte_buffer(ByteBuffer&&); static bool is_path_a_supported_image_format(StringView path) @@ -125,8 +125,8 @@ public: [[nodiscard]] u8* scanline_u8(int physical_y); [[nodiscard]] u8 const* scanline_u8(int physical_y) const; - [[nodiscard]] RGBA32* scanline(int physical_y); - [[nodiscard]] RGBA32 const* scanline(int physical_y) const; + [[nodiscard]] ARGB32* scanline(int physical_y); + [[nodiscard]] ARGB32 const* scanline(int physical_y) const; [[nodiscard]] IntRect rect() const { return { {}, m_size }; } [[nodiscard]] IntSize size() const { return m_size; } @@ -167,7 +167,7 @@ public: } } - [[nodiscard]] Vector<RGBA32> palette_to_vector() const; + [[nodiscard]] Vector<ARGB32> palette_to_vector() const; [[nodiscard]] static unsigned bpp_for_format(BitmapFormat format) { @@ -239,16 +239,16 @@ public: private: Bitmap(BitmapFormat, IntSize const&, int, BackingStore const&); Bitmap(BitmapFormat, IntSize const&, int, size_t pitch, void*); - Bitmap(BitmapFormat, Core::AnonymousBuffer, IntSize const&, int, Vector<RGBA32> const& palette); + Bitmap(BitmapFormat, Core::AnonymousBuffer, IntSize const&, int, Vector<ARGB32> const& palette); static ErrorOr<BackingStore> allocate_backing_store(BitmapFormat format, IntSize const& size, int scale_factor); - void allocate_palette_from_format(BitmapFormat, Vector<RGBA32> const& source_palette); + void allocate_palette_from_format(BitmapFormat, Vector<ARGB32> const& source_palette); IntSize m_size; int m_scale; void* m_data { nullptr }; - RGBA32* m_palette { nullptr }; + ARGB32* m_palette { nullptr }; size_t m_pitch { 0 }; BitmapFormat m_format { BitmapFormat::Invalid }; bool m_needs_munmap { false }; @@ -268,14 +268,14 @@ inline u8 const* Bitmap::scanline_u8(int y) const return reinterpret_cast<u8 const*>(m_data) + (y * m_pitch); } -inline RGBA32* Bitmap::scanline(int y) +inline ARGB32* Bitmap::scanline(int y) { - return reinterpret_cast<RGBA32*>(scanline_u8(y)); + return reinterpret_cast<ARGB32*>(scanline_u8(y)); } -inline RGBA32 const* Bitmap::scanline(int y) const +inline ARGB32 const* Bitmap::scanline(int y) const { - return reinterpret_cast<RGBA32 const*>(scanline_u8(y)); + return reinterpret_cast<ARGB32 const*>(scanline_u8(y)); } template<> diff --git a/Userland/Libraries/LibGfx/Color.cpp b/Userland/Libraries/LibGfx/Color.cpp index f37984d9c6..65fd3fb557 100644 --- a/Userland/Libraries/LibGfx/Color.cpp +++ b/Userland/Libraries/LibGfx/Color.cpp @@ -78,12 +78,12 @@ Optional<Color> Color::from_string(StringView string) return {}; struct ColorAndWebName { - constexpr ColorAndWebName(RGBA32 c, char const* n) + constexpr ColorAndWebName(ARGB32 c, char const* n) : color(c) , name(n) { } - RGBA32 color; + ARGB32 color; StringView name; }; diff --git a/Userland/Libraries/LibGfx/Color.h b/Userland/Libraries/LibGfx/Color.h index 062910e05a..3859423c15 100644 --- a/Userland/Libraries/LibGfx/Color.h +++ b/Userland/Libraries/LibGfx/Color.h @@ -17,7 +17,7 @@ namespace Gfx { enum class ColorRole; -typedef u32 RGBA32; +typedef u32 ARGB32; struct HSV { double hue { 0 }; @@ -277,7 +277,7 @@ public: return Color(((other.m_value ^ m_value) & 0x00ffffff) | (m_value & 0xff000000)); } - constexpr RGBA32 value() const { return m_value; } + constexpr ARGB32 value() const { return m_value; } constexpr bool operator==(Color const& other) const { @@ -399,12 +399,12 @@ public: } private: - constexpr explicit Color(RGBA32 rgba) + constexpr explicit Color(ARGB32 rgba) : m_value(rgba) { } - RGBA32 m_value { 0 }; + ARGB32 m_value { 0 }; }; constexpr Color::Color(NamedColor named) diff --git a/Userland/Libraries/LibGfx/GIFLoader.cpp b/Userland/Libraries/LibGfx/GIFLoader.cpp index 6860d1ab6b..a715a08bfc 100644 --- a/Userland/Libraries/LibGfx/GIFLoader.cpp +++ b/Userland/Libraries/LibGfx/GIFLoader.cpp @@ -251,8 +251,8 @@ static void clear_rect(Bitmap& bitmap, const IntRect& rect, Color color) if (intersection_rect.is_empty()) return; - RGBA32* dst = bitmap.scanline(intersection_rect.top()) + intersection_rect.left(); - const size_t dst_skip = bitmap.pitch() / sizeof(RGBA32); + ARGB32* dst = bitmap.scanline(intersection_rect.top()) + intersection_rect.left(); + const size_t dst_skip = bitmap.pitch() / sizeof(ARGB32); for (int i = intersection_rect.height() - 1; i >= 0; --i) { fast_u32_fill(dst, color.value(), intersection_rect.width()); diff --git a/Userland/Libraries/LibGfx/PNGLoader.cpp b/Userland/Libraries/LibGfx/PNGLoader.cpp index 4dc64e36a6..42eb76268e 100644 --- a/Userland/Libraries/LibGfx/PNGLoader.cpp +++ b/Userland/Libraries/LibGfx/PNGLoader.cpp @@ -177,7 +177,7 @@ ALWAYS_INLINE static u8 paeth_predictor(int a, int b, int c) } union [[gnu::packed]] Pixel { - RGBA32 rgba { 0 }; + ARGB32 rgba { 0 }; u8 v[4]; struct { u8 r; @@ -460,7 +460,7 @@ NEVER_INLINE FLATTEN static ErrorOr<void> unfilter(PNGLoadingContext& context) break; } - u8 dummy_scanline[context.width * sizeof(RGBA32)]; + u8 dummy_scanline[context.width * sizeof(ARGB32)]; memset(dummy_scanline, 0, sizeof(dummy_scanline)); for (int y = 0; y < context.height; ++y) { diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp index 25cefe2d1e..fda618d52e 100644 --- a/Userland/Libraries/LibGfx/Painter.cpp +++ b/Userland/Libraries/LibGfx/Painter.cpp @@ -84,8 +84,8 @@ void Painter::fill_rect_with_draw_op(IntRect const& a_rect, Color color) if (rect.is_empty()) return; - RGBA32* dst = m_target->scanline(rect.top()) + rect.left(); - size_t const dst_skip = m_target->pitch() / sizeof(RGBA32); + ARGB32* dst = m_target->scanline(rect.top()) + rect.left(); + size_t const dst_skip = m_target->pitch() / sizeof(ARGB32); for (int i = rect.height() - 1; i >= 0; --i) { for (int j = 0; j < rect.width(); ++j) @@ -103,8 +103,8 @@ void Painter::clear_rect(IntRect const& a_rect, Color color) VERIFY(m_target->rect().contains(rect)); rect *= scale(); - RGBA32* dst = m_target->scanline(rect.top()) + rect.left(); - size_t const dst_skip = m_target->pitch() / sizeof(RGBA32); + ARGB32* dst = m_target->scanline(rect.top()) + rect.left(); + size_t const dst_skip = m_target->pitch() / sizeof(ARGB32); for (int i = rect.height() - 1; i >= 0; --i) { fast_u32_fill(dst, color.value(), rect.width()); @@ -115,8 +115,8 @@ void Painter::clear_rect(IntRect const& a_rect, Color color) void Painter::fill_physical_rect(IntRect const& physical_rect, Color color) { // Callers must do clipping. - RGBA32* dst = m_target->scanline(physical_rect.top()) + physical_rect.left(); - size_t const dst_skip = m_target->pitch() / sizeof(RGBA32); + ARGB32* dst = m_target->scanline(physical_rect.top()) + physical_rect.left(); + size_t const dst_skip = m_target->pitch() / sizeof(ARGB32); for (int i = physical_rect.height() - 1; i >= 0; --i) { for (int j = 0; j < physical_rect.width(); ++j) @@ -156,8 +156,8 @@ void Painter::fill_rect_with_dither_pattern(IntRect const& a_rect, Color color_a if (rect.is_empty()) return; - RGBA32* dst = m_target->scanline(rect.top()) + rect.left(); - size_t const dst_skip = m_target->pitch() / sizeof(RGBA32); + ARGB32* dst = m_target->scanline(rect.top()) + rect.left(); + size_t const dst_skip = m_target->pitch() / sizeof(ARGB32); for (int i = 0; i < rect.height(); ++i) { for (int j = 0; j < rect.width(); ++j) { @@ -180,8 +180,8 @@ void Painter::fill_rect_with_checkerboard(IntRect const& a_rect, IntSize const& if (rect.is_empty()) return; - RGBA32* dst = m_target->scanline(rect.top()) + rect.left(); - size_t const dst_skip = m_target->pitch() / sizeof(RGBA32); + ARGB32* dst = m_target->scanline(rect.top()) + rect.left(); + size_t const dst_skip = m_target->pitch() / sizeof(ARGB32); int first_cell_column = rect.x() / cell_size.width(); int prologue_length = min(rect.width(), cell_size.width() - (rect.x() % cell_size.width())); @@ -240,8 +240,8 @@ void Painter::fill_rect_with_gradient(Orientation orientation, IntRect const& a_ int offset = clipped_rect.primary_offset_for_orientation(orientation) - rect.primary_offset_for_orientation(orientation); - RGBA32* dst = m_target->scanline(clipped_rect.top()) + clipped_rect.left(); - size_t const dst_skip = m_target->pitch() / sizeof(RGBA32); + ARGB32* dst = m_target->scanline(clipped_rect.top()) + clipped_rect.left(); + size_t const dst_skip = m_target->pitch() / sizeof(ARGB32); float increment = (1.0 / ((rect.primary_size_for_orientation(orientation)))); float alpha_increment = increment * ((float)gradient_end.alpha() - (float)gradient_start.alpha()); @@ -389,8 +389,8 @@ void Painter::fill_rounded_corner(IntRect const& a_rect, int radius, Color color rect *= scale(); clip_offset *= scale(); - RGBA32* dst = m_target->scanline(rect.top()) + rect.left(); - size_t const dst_skip = m_target->pitch() / sizeof(RGBA32); + ARGB32* dst = m_target->scanline(rect.top()) + rect.left(); + size_t const dst_skip = m_target->pitch() / sizeof(ARGB32); IntPoint circle_center; switch (orientation) { @@ -456,8 +456,8 @@ void Painter::draw_circle_arc_intersecting(IntRect const& a_rect, IntPoint const return distance2 <= (radius2 + radius + 0.25) && distance2 >= (radius2 - radius + 0.25); }; - RGBA32* dst = m_target->scanline(rect.top()) + rect.left(); - size_t const dst_skip = m_target->pitch() / sizeof(RGBA32); + ARGB32* dst = m_target->scanline(rect.top()) + rect.left(); + size_t const dst_skip = m_target->pitch() / sizeof(ARGB32); for (int i = rect.height() - 1; i >= 0; --i) { for (int j = 0; j < rect.width(); ++j) @@ -621,8 +621,8 @@ void Painter::draw_bitmap(IntPoint const& p, CharacterBitmap const& bitmap, Colo int const last_row = clipped_rect.bottom() - rect.top(); int const first_column = clipped_rect.left() - rect.left(); int const last_column = clipped_rect.right() - rect.left(); - RGBA32* dst = m_target->scanline(clipped_rect.y()) + clipped_rect.x(); - size_t const dst_skip = m_target->pitch() / sizeof(RGBA32); + ARGB32* dst = m_target->scanline(clipped_rect.y()) + clipped_rect.x(); + size_t const dst_skip = m_target->pitch() / sizeof(ARGB32); char const* bitmap_row = &bitmap.bits()[first_row * bitmap.width() + first_column]; size_t const bitmap_skip = bitmap.width(); @@ -649,8 +649,8 @@ void Painter::draw_bitmap(IntPoint const& p, GlyphBitmap const& bitmap, Color co int const last_column = clipped_rect.right() - dst_rect.left(); int scale = this->scale(); - RGBA32* dst = m_target->scanline(clipped_rect.y() * scale) + clipped_rect.x() * scale; - size_t const dst_skip = m_target->pitch() / sizeof(RGBA32); + ARGB32* dst = m_target->scanline(clipped_rect.y() * scale) + clipped_rect.x() * scale; + size_t const dst_skip = m_target->pitch() / sizeof(ARGB32); if (scale == 1) { for (int row = first_row; row <= last_row; ++row) { @@ -762,8 +762,8 @@ struct BlitState { BothAlpha = SrcAlpha | DstAlpha }; - RGBA32 const* src; - RGBA32* dst; + ARGB32 const* src; + ARGB32* dst; size_t src_pitch; size_t dst_pitch; int row_count; @@ -822,8 +822,8 @@ void Painter::blit_with_opacity(IntPoint const& position, Gfx::Bitmap const& sou BlitState blit_state { .src = source.scanline(src_rect.top() + first_row) + src_rect.left() + first_column, .dst = m_target->scanline(clipped_rect.y()) + clipped_rect.x(), - .src_pitch = source.pitch() / sizeof(RGBA32), - .dst_pitch = m_target->pitch() / sizeof(RGBA32), + .src_pitch = source.pitch() / sizeof(ARGB32), + .dst_pitch = m_target->pitch() / sizeof(ARGB32), .row_count = last_row - first_row + 1, .column_count = last_column - first_column + 1, .opacity = opacity @@ -861,13 +861,13 @@ void Painter::blit_filtered(IntPoint const& position, Gfx::Bitmap const& source, int const last_row = clipped_rect.bottom() - dst_rect.top(); int const first_column = clipped_rect.left() - dst_rect.left(); int const last_column = clipped_rect.right() - dst_rect.left(); - RGBA32* dst = m_target->scanline(clipped_rect.y()) + clipped_rect.x(); - size_t const dst_skip = m_target->pitch() / sizeof(RGBA32); + ARGB32* dst = m_target->scanline(clipped_rect.y()) + clipped_rect.x(); + size_t const dst_skip = m_target->pitch() / sizeof(ARGB32); int s = scale / source.scale(); if (s == 1) { - RGBA32 const* src = source.scanline(safe_src_rect.top() + first_row) + safe_src_rect.left() + first_column; - size_t const src_skip = source.pitch() / sizeof(RGBA32); + ARGB32 const* src = source.scanline(safe_src_rect.top() + first_row) + safe_src_rect.left() + first_column; + size_t const src_skip = source.pitch() / sizeof(ARGB32); for (int row = first_row; row <= last_row; ++row) { for (int x = 0; x <= (last_column - first_column); ++x) { @@ -888,7 +888,7 @@ void Painter::blit_filtered(IntPoint const& position, Gfx::Bitmap const& source, } } else { for (int row = first_row; row <= last_row; ++row) { - RGBA32 const* src = source.scanline(safe_src_rect.top() + row / s) + safe_src_rect.left() + first_column / s; + ARGB32 const* src = source.scanline(safe_src_rect.top() + row / s) + safe_src_rect.left() + first_column / s; for (int x = 0; x <= (last_column - first_column); ++x) { u8 alpha = Color::from_rgba(src[x / s]).alpha(); if (alpha == 0xff) { @@ -937,15 +937,15 @@ void Painter::draw_tiled_bitmap(IntRect const& a_dst_rect, Gfx::Bitmap const& so int const first_row = (clipped_rect.top() - dst_rect.top()); int const last_row = (clipped_rect.bottom() - dst_rect.top()); int const first_column = (clipped_rect.left() - dst_rect.left()); - RGBA32* dst = m_target->scanline(clipped_rect.y()) + clipped_rect.x(); - size_t const dst_skip = m_target->pitch() / sizeof(RGBA32); + ARGB32* dst = m_target->scanline(clipped_rect.y()) + clipped_rect.x(); + size_t const dst_skip = m_target->pitch() / sizeof(ARGB32); if (source.format() == BitmapFormat::BGRx8888 || source.format() == BitmapFormat::BGRA8888) { int s = scale / source.scale(); if (s == 1) { int x_start = first_column + a_dst_rect.left() * scale; for (int row = first_row; row <= last_row; ++row) { - RGBA32 const* sl = source.scanline((row + a_dst_rect.top() * scale) % source.physical_height()); + ARGB32 const* sl = source.scanline((row + a_dst_rect.top() * scale) % source.physical_height()); for (int x = x_start; x < clipped_rect.width() + x_start; ++x) { dst[x - x_start] = sl[x % source.physical_width()]; } @@ -954,7 +954,7 @@ void Painter::draw_tiled_bitmap(IntRect const& a_dst_rect, Gfx::Bitmap const& so } else { int x_start = first_column + a_dst_rect.left() * scale; for (int row = first_row; row <= last_row; ++row) { - RGBA32 const* sl = source.scanline(((row + a_dst_rect.top() * scale) / s) % source.physical_height()); + ARGB32 const* sl = source.scanline(((row + a_dst_rect.top() * scale) / s) % source.physical_height()); for (int x = x_start; x < clipped_rect.width() + x_start; ++x) { dst[x - x_start] = sl[(x / s) % source.physical_width()]; } @@ -1009,12 +1009,12 @@ void Painter::blit(IntPoint const& position, Gfx::Bitmap const& source, IntRect int const first_row = clipped_rect.top() - dst_rect.top(); int const last_row = clipped_rect.bottom() - dst_rect.top(); int const first_column = clipped_rect.left() - dst_rect.left(); - RGBA32* dst = m_target->scanline(clipped_rect.y()) + clipped_rect.x(); - size_t const dst_skip = m_target->pitch() / sizeof(RGBA32); + ARGB32* dst = m_target->scanline(clipped_rect.y()) + clipped_rect.x(); + size_t const dst_skip = m_target->pitch() / sizeof(ARGB32); if (source.format() == BitmapFormat::BGRx8888 || source.format() == BitmapFormat::BGRA8888) { - RGBA32 const* src = source.scanline(src_rect.top() + first_row) + src_rect.left() + first_column; - size_t const src_skip = source.pitch() / sizeof(RGBA32); + ARGB32 const* src = source.scanline(src_rect.top() + first_row) + src_rect.left() + first_column; + size_t const src_skip = source.pitch() / sizeof(ARGB32); for (int row = first_row; row <= last_row; ++row) { fast_u32_copy(dst, src, clipped_rect.width()); dst += dst_skip; diff --git a/Userland/Libraries/LibGfx/ShareableBitmap.cpp b/Userland/Libraries/LibGfx/ShareableBitmap.cpp index 70f6d2dc9a..f76be7d897 100644 --- a/Userland/Libraries/LibGfx/ShareableBitmap.cpp +++ b/Userland/Libraries/LibGfx/ShareableBitmap.cpp @@ -58,7 +58,7 @@ ErrorOr<void> decode(Decoder& decoder, Gfx::ShareableBitmap& shareable_bitmap) if (!Gfx::is_valid_bitmap_format(raw_bitmap_format)) return Error::from_string_literal("IPC: Invalid Gfx::ShareableBitmap format"sv); auto bitmap_format = (Gfx::BitmapFormat)raw_bitmap_format; - Vector<Gfx::RGBA32> palette; + Vector<Gfx::ARGB32> palette; if (Gfx::Bitmap::is_indexed(bitmap_format)) { TRY(decoder.decode(palette)); } diff --git a/Userland/Libraries/LibGfx/SystemTheme.h b/Userland/Libraries/LibGfx/SystemTheme.h index c2a90a8fe3..30b15b4279 100644 --- a/Userland/Libraries/LibGfx/SystemTheme.h +++ b/Userland/Libraries/LibGfx/SystemTheme.h @@ -258,7 +258,7 @@ inline const char* to_string(PathRole role) } struct SystemTheme { - RGBA32 color[(int)ColorRole::__Count]; + ARGB32 color[(int)ColorRole::__Count]; Gfx::TextAlignment alignment[(int)AlignmentRole::__Count]; bool flag[(int)FlagRole::__Count]; int metric[(int)MetricRole::__Count]; diff --git a/Userland/Services/WindowServer/Compositor.cpp b/Userland/Services/WindowServer/Compositor.cpp index af9a16e3f8..a173a888ae 100644 --- a/Userland/Services/WindowServer/Compositor.cpp +++ b/Userland/Services/WindowServer/Compositor.cpp @@ -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 diff --git a/Userland/Services/WindowServer/Screen.cpp b/Userland/Services/WindowServer/Screen.cpp index 2bc492bdb4..242a7be4fc 100644 --- a/Userland/Services/WindowServer/Screen.cpp +++ b/Userland/Services/WindowServer/Screen.cpp @@ -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) { diff --git a/Userland/Services/WindowServer/Screen.h b/Userland/Services/WindowServer/Screen.h index c4f8810984..f8e41caeb2 100644 --- a/Userland/Services/WindowServer/Screen.h +++ b/Userland/Services/WindowServer/Screen.h @@ -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)); } } |