diff options
Diffstat (limited to 'Userland/Libraries')
-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.h | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibGfx/Color.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibGfx/Color.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibGfx/Painter.cpp | 42 | ||||
-rw-r--r-- | Userland/Libraries/LibGfx/Palette.h | 2 |
7 files changed, 29 insertions, 29 deletions
diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.cpp b/Userland/Libraries/LibGL/SoftwareGLContext.cpp index d544787881..1d63bbc688 100644 --- a/Userland/Libraries/LibGL/SoftwareGLContext.cpp +++ b/Userland/Libraries/LibGL/SoftwareGLContext.cpp @@ -2305,7 +2305,7 @@ void SoftwareGLContext::gl_draw_pixels(GLsizei width, GLsizei height, GLenum for auto pixel_data = static_cast<u32 const*>(data); for (int y = 0; y < height; ++y) for (int x = 0; x < width; ++x) - bitmap->set_pixel(x, y, Color::from_rgba(*(pixel_data++))); + bitmap->set_pixel(x, y, Color::from_argb(*(pixel_data++))); m_rasterizer.blit_to_color_buffer_at_raster_position(bitmap); } else if (format == GL_DEPTH_COMPONENT) { diff --git a/Userland/Libraries/LibGUI/Variant.h b/Userland/Libraries/LibGUI/Variant.h index ccdcd241d5..8862bfa27f 100644 --- a/Userland/Libraries/LibGUI/Variant.h +++ b/Userland/Libraries/LibGUI/Variant.h @@ -235,7 +235,7 @@ public: Color as_color() const { VERIFY(type() == Type::Color); - return Color::from_rgba(m_value.as_color); + return Color::from_argb(m_value.as_color); } const Gfx::Font& as_font() const diff --git a/Userland/Libraries/LibGfx/Bitmap.h b/Userland/Libraries/LibGfx/Bitmap.h index 82d421b477..83cbcd979d 100644 --- a/Userland/Libraries/LibGfx/Bitmap.h +++ b/Userland/Libraries/LibGfx/Bitmap.h @@ -207,7 +207,7 @@ public: [[nodiscard]] static constexpr size_t size_in_bytes(size_t pitch, int physical_height) { return pitch * physical_height; } [[nodiscard]] size_t size_in_bytes() const { return size_in_bytes(m_pitch, physical_height()); } - [[nodiscard]] Color palette_color(u8 index) const { return Color::from_rgba(m_palette[index]); } + [[nodiscard]] Color palette_color(u8 index) const { return Color::from_argb(m_palette[index]); } void set_palette_color(u8 index, Color color) { m_palette[index] = color.value(); } template<StorageFormat> @@ -289,7 +289,7 @@ template<> inline Color Bitmap::get_pixel<StorageFormat::BGRA8888>(int x, int y) const { VERIFY(x >= 0 && x < physical_width()); - return Color::from_rgba(scanline(y)[x]); + return Color::from_argb(scanline(y)[x]); } template<> diff --git a/Userland/Libraries/LibGfx/Color.cpp b/Userland/Libraries/LibGfx/Color.cpp index 65fd3fb557..d0fe3a642b 100644 --- a/Userland/Libraries/LibGfx/Color.cpp +++ b/Userland/Libraries/LibGfx/Color.cpp @@ -245,7 +245,7 @@ Optional<Color> Color::from_string(StringView string) }; if (string.equals_ignoring_case("transparent")) - return Color::from_rgba(0x00000000); + return Color::from_argb(0x00000000); for (size_t i = 0; !web_colors[i].name.is_null(); ++i) { if (string.equals_ignoring_case(web_colors[i].name)) @@ -346,7 +346,7 @@ ErrorOr<void> IPC::decode(IPC::Decoder& decoder, Color& color) { u32 rgba; TRY(decoder.decode(rgba)); - color = Color::from_rgba(rgba); + color = Color::from_argb(rgba); return {}; } diff --git a/Userland/Libraries/LibGfx/Color.h b/Userland/Libraries/LibGfx/Color.h index 3859423c15..42fd140f7a 100644 --- a/Userland/Libraries/LibGfx/Color.h +++ b/Userland/Libraries/LibGfx/Color.h @@ -64,7 +64,7 @@ public: } static constexpr Color from_rgb(unsigned rgb) { return Color(rgb | 0xff000000); } - static constexpr Color from_rgba(unsigned rgba) { return Color(rgba); } + static constexpr Color from_argb(unsigned argb) { return Color(argb); } static constexpr Color from_cmyk(float c, float m, float y, float k) { diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp index fda618d52e..50df2c9604 100644 --- a/Userland/Libraries/LibGfx/Painter.cpp +++ b/Userland/Libraries/LibGfx/Painter.cpp @@ -54,7 +54,7 @@ ALWAYS_INLINE Color get_pixel(Gfx::Bitmap const& bitmap, int x, int y) if constexpr (format == BitmapFormat::BGRx8888) return Color::from_rgb(bitmap.scanline(y)[x]); if constexpr (format == BitmapFormat::BGRA8888) - return Color::from_rgba(bitmap.scanline(y)[x]); + return Color::from_argb(bitmap.scanline(y)[x]); return bitmap.get_pixel(x, y); } @@ -120,7 +120,7 @@ void Painter::fill_physical_rect(IntRect const& physical_rect, Color color) for (int i = physical_rect.height() - 1; i >= 0; --i) { for (int j = 0; j < physical_rect.width(); ++j) - dst[j] = Color::from_rgba(dst[j]).blend(color).value(); + dst[j] = Color::from_argb(dst[j]).blend(color).value(); dst += dst_skip; } } @@ -421,7 +421,7 @@ void Painter::fill_rounded_corner(IntRect const& a_rect, int radius, Color color for (int i = rect.height() - 1; i >= 0; --i) { for (int j = 0; j < rect.width(); ++j) if (is_in_circle(j, rect.height() - i + clip_offset)) - dst[j] = Color::from_rgba(dst[j]).blend(color).value(); + dst[j] = Color::from_argb(dst[j]).blend(color).value(); dst += dst_skip; } } @@ -462,7 +462,7 @@ void Painter::draw_circle_arc_intersecting(IntRect const& a_rect, IntPoint const for (int i = rect.height() - 1; i >= 0; --i) { for (int j = 0; j < rect.width(); ++j) if (is_on_arc(j, rect.height() - i + clip_offset)) - dst[j] = Color::from_rgba(dst[j]).blend(color).value(); + dst[j] = Color::from_argb(dst[j]).blend(color).value(); dst += dst_skip; } @@ -656,7 +656,7 @@ void Painter::draw_bitmap(IntPoint const& p, GlyphBitmap const& bitmap, Color co for (int row = first_row; row <= last_row; ++row) { for (int j = 0; j <= (last_column - first_column); ++j) { if (bitmap.bit_at(j + first_column, row)) - dst[j] = Color::from_rgba(dst[j]).blend(color).value(); + dst[j] = Color::from_argb(dst[j]).blend(color).value(); } dst += dst_skip; } @@ -667,7 +667,7 @@ void Painter::draw_bitmap(IntPoint const& p, GlyphBitmap const& bitmap, Color co for (int iy = 0; iy < scale; ++iy) for (int ix = 0; ix < scale; ++ix) { auto pixel_index = j * scale + ix + iy * dst_skip; - dst[pixel_index] = Color::from_rgba(dst[pixel_index]).blend(color).value(); + dst[pixel_index] = Color::from_argb(dst[pixel_index]).blend(color).value(); } } } @@ -776,9 +776,9 @@ static void do_blit_with_opacity(BlitState& state) { for (int row = 0; row < state.row_count; ++row) { for (int x = 0; x < state.column_count; ++x) { - Color dest_color = (has_alpha & BlitState::DstAlpha) ? Color::from_rgba(state.dst[x]) : Color::from_rgb(state.dst[x]); + Color dest_color = (has_alpha & BlitState::DstAlpha) ? Color::from_argb(state.dst[x]) : Color::from_rgb(state.dst[x]); if constexpr (has_alpha & BlitState::SrcAlpha) { - Color src_color_with_alpha = Color::from_rgba(state.src[x]); + Color src_color_with_alpha = Color::from_argb(state.src[x]); float pixel_opacity = src_color_with_alpha.alpha() / 255.0; src_color_with_alpha.set_alpha(255 * (state.opacity * pixel_opacity)); state.dst[x] = dest_color.blend(src_color_with_alpha).value(); @@ -871,17 +871,17 @@ void Painter::blit_filtered(IntPoint const& position, Gfx::Bitmap const& source, for (int row = first_row; row <= last_row; ++row) { for (int x = 0; x <= (last_column - first_column); ++x) { - u8 alpha = Color::from_rgba(src[x]).alpha(); + u8 alpha = Color::from_argb(src[x]).alpha(); if (alpha == 0xff) { - auto color = filter(Color::from_rgba(src[x])); + auto color = filter(Color::from_argb(src[x])); if (color.alpha() == 0xff) dst[x] = color.value(); else - dst[x] = Color::from_rgba(dst[x]).blend(color).value(); + dst[x] = Color::from_argb(dst[x]).blend(color).value(); } else if (!alpha) continue; else - dst[x] = Color::from_rgba(dst[x]).blend(filter(Color::from_rgba(src[x]))).value(); + dst[x] = Color::from_argb(dst[x]).blend(filter(Color::from_argb(src[x]))).value(); } dst += dst_skip; src += src_skip; @@ -890,17 +890,17 @@ void Painter::blit_filtered(IntPoint const& position, Gfx::Bitmap const& source, for (int row = first_row; row <= last_row; ++row) { 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(); + u8 alpha = Color::from_argb(src[x / s]).alpha(); if (alpha == 0xff) { - auto color = filter(Color::from_rgba(src[x / s])); + auto color = filter(Color::from_argb(src[x / s])); if (color.alpha() == 0xff) dst[x] = color.value(); else - dst[x] = Color::from_rgba(dst[x]).blend(color).value(); + dst[x] = Color::from_argb(dst[x]).blend(color).value(); } else if (!alpha) continue; else - dst[x] = Color::from_rgba(dst[x]).blend(filter(Color::from_rgba(src[x / s]))).value(); + dst[x] = Color::from_argb(dst[x]).blend(filter(Color::from_argb(src[x / s]))).value(); } dst += dst_skip; } @@ -1680,10 +1680,10 @@ ALWAYS_INLINE void Painter::set_physical_pixel_with_draw_op(u32& pixel, Color co pixel = color.value(); break; case DrawOp::Xor: - pixel = color.xored(Color::from_rgba(pixel)).value(); + pixel = color.xored(Color::from_argb(pixel)).value(); break; case DrawOp::Invert: - pixel = Color::from_rgba(pixel).inverted().value(); + pixel = Color::from_argb(pixel).inverted().value(); break; } } @@ -1701,7 +1701,7 @@ ALWAYS_INLINE void Painter::fill_physical_scanline_with_draw_op(int y, int x, in auto* pixel = m_target->scanline(y) + x; auto* end = pixel + width; while (pixel < end) { - *pixel = Color::from_rgba(*pixel).xored(color).value(); + *pixel = Color::from_argb(*pixel).xored(color).value(); pixel++; } break; @@ -1710,7 +1710,7 @@ ALWAYS_INLINE void Painter::fill_physical_scanline_with_draw_op(int y, int x, in auto* pixel = m_target->scanline(y) + x; auto* end = pixel + width; while (pixel < end) { - *pixel = Color::from_rgba(*pixel).inverted().value(); + *pixel = Color::from_argb(*pixel).inverted().value(); pixel++; } break; @@ -1730,7 +1730,7 @@ void Painter::draw_physical_pixel(IntPoint const& physical_position, Color color if (thickness == 1) { // Implies scale() == 1. auto& pixel = m_target->scanline(physical_position.y())[physical_position.x()]; - return set_physical_pixel_with_draw_op(pixel, Color::from_rgba(pixel).blend(color)); + return set_physical_pixel_with_draw_op(pixel, Color::from_argb(pixel).blend(color)); } IntRect rect { physical_position, { thickness, thickness } }; diff --git a/Userland/Libraries/LibGfx/Palette.h b/Userland/Libraries/LibGfx/Palette.h index 4d0e9096ec..d6d5d9cef3 100644 --- a/Userland/Libraries/LibGfx/Palette.h +++ b/Userland/Libraries/LibGfx/Palette.h @@ -29,7 +29,7 @@ public: Color color(ColorRole role) const { VERIFY((int)role < (int)ColorRole::__Count); - return Color::from_rgba(theme().color[(int)role]); + return Color::from_argb(theme().color[(int)role]); } Gfx::TextAlignment alignment(AlignmentRole role) const |