Skip to content

Commit 7c315ef

Browse files
InvalidUsernameExceptiongmta
authored andcommitted
Everywhere: Unify naming of RGBA-like colors
The `Bitmap` type was referring to to its internal pixel format by a name that represents the order of the color components as they are layed out in memory. Contrary, the `Color` type was using a naming that where the name represents the order of the components from most to least significant byte when viewed as a unsigned 32bit integer. This is confusing as you have to keep remembering which mental model to use depending on which code you work with. To unify the two, the naming of RGBA-like colors in the `Color` type has been adjusted to match the one from the Bitmap type. This seems to be generally in line with how web APIs think about these types: * `ImageData.pixelFormat` can be `rgba-8unorm` backed by a `Uint8ClamedArray`, but there is no pixel format backed by a 32bit unsigned type. * WebGL can use format `RGBA` with type `UNSIGNED_BYTE`, but there is no such format with type `UNSIGNED_INT`. Additionally, it appears that other browsers and browser-adjacent libraries also think similarly about these types: * Firefox: https://github.com/mozilla-firefox/firefox/blob/main/gfx/2d/Types.h * WebKit: https://github.com/WebKit/WebKit/blob/main/Source/WebCore/platform/graphics/PixelFormat.h * Skia: https://chromium.googlesource.com/skia/+/refs/heads/main/include/core/SkColorType.h This has the not so nice side effect that APIs that interact with these types through 32bit unsigned integers now have the component order inverted due to little-endian byte order. E.g. specifying a color as hex constant needs to be done as `0xAABBGGRR` if it is to be treated as RGBA8888. We could alleviate this by providing endian-independent APIs to callers. But I suspect long-term we might want to think differently about bitmap data anyway, e.g. to better support HDR in the future. However, such changes would be more involved than just unifying the naming as done here. So I considered that out of scope for now.
1 parent 07f61f2 commit 7c315ef

File tree

14 files changed

+132
-130
lines changed

14 files changed

+132
-130
lines changed

Libraries/LibGfx/Bitmap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ Bitmap::~Bitmap()
241241
void Bitmap::strip_alpha_channel()
242242
{
243243
VERIFY(m_format == BitmapFormat::BGRA8888 || m_format == BitmapFormat::BGRx8888);
244-
for (ARGB32& pixel : *this)
244+
for (BGRA8888& pixel : *this)
245245
pixel = 0xff000000 | (pixel & 0xffffff);
246246
m_format = BitmapFormat::BGRx8888;
247247
}

Libraries/LibGfx/Bitmap.h

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,18 @@ class Bitmap : public AtomicRefCounted<Bitmap> {
7070

7171
[[nodiscard]] u8* scanline_u8(int physical_y);
7272
[[nodiscard]] u8 const* scanline_u8(int physical_y) const;
73-
[[nodiscard]] ARGB32* scanline(int physical_y);
74-
[[nodiscard]] ARGB32 const* scanline(int physical_y) const;
73+
[[nodiscard]] BGRA8888* scanline(int physical_y);
74+
[[nodiscard]] BGRA8888 const* scanline(int physical_y) const;
7575

7676
[[nodiscard]] u8* unchecked_scanline_u8(int physical_y);
7777
[[nodiscard]] u8 const* unchecked_scanline_u8(int physical_y) const;
78-
[[nodiscard]] ARGB32* unchecked_scanline(int physical_y);
79-
[[nodiscard]] ARGB32 const* unchecked_scanline(int physical_y) const;
78+
[[nodiscard]] BGRA8888* unchecked_scanline(int physical_y);
79+
[[nodiscard]] BGRA8888 const* unchecked_scanline(int physical_y) const;
8080

81-
[[nodiscard]] ARGB32* begin();
82-
[[nodiscard]] ARGB32 const* begin() const;
83-
[[nodiscard]] ARGB32* end();
84-
[[nodiscard]] ARGB32 const* end() const;
81+
[[nodiscard]] BGRA8888* begin();
82+
[[nodiscard]] BGRA8888 const* begin() const;
83+
[[nodiscard]] BGRA8888* end();
84+
[[nodiscard]] BGRA8888 const* end() const;
8585
[[nodiscard]] size_t data_size() const;
8686

8787
[[nodiscard]] IntRect rect() const { return { {}, m_size }; }
@@ -164,14 +164,14 @@ ALWAYS_INLINE u8 const* Bitmap::unchecked_scanline_u8(int y) const
164164
return reinterpret_cast<u8 const*>(m_data) + (y * m_pitch);
165165
}
166166

167-
ALWAYS_INLINE ARGB32* Bitmap::unchecked_scanline(int y)
167+
ALWAYS_INLINE BGRA8888* Bitmap::unchecked_scanline(int y)
168168
{
169-
return reinterpret_cast<ARGB32*>(unchecked_scanline_u8(y));
169+
return reinterpret_cast<BGRA8888*>(unchecked_scanline_u8(y));
170170
}
171171

172-
ALWAYS_INLINE ARGB32 const* Bitmap::unchecked_scanline(int y) const
172+
ALWAYS_INLINE BGRA8888 const* Bitmap::unchecked_scanline(int y) const
173173
{
174-
return reinterpret_cast<ARGB32 const*>(unchecked_scanline_u8(y));
174+
return reinterpret_cast<BGRA8888 const*>(unchecked_scanline_u8(y));
175175
}
176176

177177
ALWAYS_INLINE u8* Bitmap::scanline_u8(int y)
@@ -188,34 +188,34 @@ ALWAYS_INLINE u8 const* Bitmap::scanline_u8(int y) const
188188
return unchecked_scanline_u8(y);
189189
}
190190

191-
ALWAYS_INLINE ARGB32* Bitmap::scanline(int y)
191+
ALWAYS_INLINE BGRA8888* Bitmap::scanline(int y)
192192
{
193-
return reinterpret_cast<ARGB32*>(scanline_u8(y));
193+
return reinterpret_cast<BGRA8888*>(scanline_u8(y));
194194
}
195195

196-
ALWAYS_INLINE ARGB32 const* Bitmap::scanline(int y) const
196+
ALWAYS_INLINE BGRA8888 const* Bitmap::scanline(int y) const
197197
{
198-
return reinterpret_cast<ARGB32 const*>(scanline_u8(y));
198+
return reinterpret_cast<BGRA8888 const*>(scanline_u8(y));
199199
}
200200

201-
ALWAYS_INLINE ARGB32* Bitmap::begin()
201+
ALWAYS_INLINE BGRA8888* Bitmap::begin()
202202
{
203203
return scanline(0);
204204
}
205205

206-
ALWAYS_INLINE ARGB32 const* Bitmap::begin() const
206+
ALWAYS_INLINE BGRA8888 const* Bitmap::begin() const
207207
{
208208
return scanline(0);
209209
}
210210

211-
ALWAYS_INLINE ARGB32* Bitmap::end()
211+
ALWAYS_INLINE BGRA8888* Bitmap::end()
212212
{
213-
return reinterpret_cast<ARGB32*>(reinterpret_cast<u8*>(m_data) + data_size());
213+
return reinterpret_cast<BGRA8888*>(reinterpret_cast<u8*>(m_data) + data_size());
214214
}
215215

216-
ALWAYS_INLINE ARGB32 const* Bitmap::end() const
216+
ALWAYS_INLINE BGRA8888 const* Bitmap::end() const
217217
{
218-
return reinterpret_cast<ARGB32 const*>(reinterpret_cast<u8 const*>(m_data) + data_size());
218+
return reinterpret_cast<BGRA8888 const*>(reinterpret_cast<u8 const*>(m_data) + data_size());
219219
}
220220

221221
ALWAYS_INLINE size_t Bitmap::data_size() const
@@ -230,13 +230,13 @@ ALWAYS_INLINE Color Bitmap::get_pixel(int x, int y) const
230230
auto pixel = scanline(y)[x];
231231
switch (m_format) {
232232
case BitmapFormat::BGRx8888:
233-
return Color::from_rgb(pixel);
233+
return Color::from_bgrx(pixel);
234234
case BitmapFormat::BGRA8888:
235-
return Color::from_argb(pixel);
235+
return Color::from_bgra(pixel);
236236
case BitmapFormat::RGBA8888:
237-
return Color::from_abgr(pixel);
237+
return Color::from_rgba(pixel);
238238
case BitmapFormat::RGBx8888:
239-
return Color::from_bgr(pixel);
239+
return Color::from_rgbx(pixel);
240240
case BitmapFormat::Invalid:
241241
VERIFY_NOT_REACHED();
242242
}

Libraries/LibGfx/Color.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ Optional<Color> Color::from_named_css_color_string(StringView string)
188188
return {};
189189

190190
struct WebColor {
191-
ARGB32 color;
191+
BGRA8888 color;
192192
StringView name;
193193
};
194194

@@ -349,7 +349,7 @@ Optional<Color> Color::from_named_css_color_string(StringView string)
349349

350350
for (auto const& web_color : web_colors) {
351351
if (string.equals_ignoring_ascii_case(web_color.name))
352-
return Color::from_rgb(web_color.color);
352+
return Color::from_bgrx(web_color.color);
353353
}
354354

355355
return {};
@@ -431,7 +431,7 @@ Optional<Color> Color::from_string(StringView string)
431431
return parse_rgba_color(string);
432432

433433
if (string.equals_ignoring_ascii_case("transparent"sv))
434-
return Color::from_argb(0x00000000);
434+
return Color::from_bgra(0x00000000);
435435

436436
if (auto const color = from_named_css_color_string(string); color.has_value())
437437
return color;
@@ -639,7 +639,7 @@ template<>
639639
ErrorOr<Gfx::Color> IPC::decode(Decoder& decoder)
640640
{
641641
auto rgba = TRY(decoder.decode<u32>());
642-
return Gfx::Color::from_argb(rgba);
642+
return Gfx::Color::from_bgra(rgba);
643643
}
644644

645645
ErrorOr<void> AK::Formatter<Gfx::Color>::format(FormatBuilder& builder, Gfx::Color value)

Libraries/LibGfx/Color.h

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717

1818
namespace Gfx {
1919

20-
typedef u32 ARGB32;
20+
// Named after in memory-order (little-endian)
21+
// e.g. 0xAARRGGBB
22+
using BGRA8888 = u32;
2123

2224
enum class AlphaType {
2325
Premultiplied,
@@ -139,14 +141,14 @@ class Color {
139141

140142
static constexpr Color branded_color(BrandedColor);
141143

142-
static constexpr Color from_rgb(unsigned rgb) { return Color(rgb | 0xff000000); }
143-
static constexpr Color from_argb(unsigned argb) { return Color(argb); }
144-
static constexpr Color from_abgr(unsigned abgr)
144+
static constexpr Color from_bgrx(unsigned bgrx) { return Color(bgrx | 0xff000000); }
145+
static constexpr Color from_bgra(unsigned bgra) { return Color(bgra); }
146+
static constexpr Color from_rgba(unsigned rgba)
145147
{
146-
unsigned argb = (abgr & 0xff00ff00) | ((abgr & 0xff0000) >> 16) | ((abgr & 0xff) << 16);
147-
return Color::from_argb(argb);
148+
unsigned bgra = (rgba & 0xff00ff00) | ((rgba & 0xff0000) >> 16) | ((rgba & 0xff) << 16);
149+
return Color::from_bgra(bgra);
148150
}
149-
static constexpr Color from_bgr(unsigned bgr) { return Color::from_abgr(bgr | 0xff000000); }
151+
static constexpr Color from_rgbx(unsigned rgbx) { return Color::from_rgba(rgbx | 0xff000000); }
150152

151153
static constexpr Color from_yuv(YUV const& yuv) { return from_yuv(yuv.y, yuv.u, yuv.v); }
152154
static constexpr Color from_yuv(float y, float u, float v)
@@ -464,7 +466,7 @@ class Color {
464466
return Color(((other.m_value ^ m_value) & 0x00ffffff) | (m_value & 0xff000000));
465467
}
466468

467-
constexpr ARGB32 value() const { return m_value; }
469+
constexpr BGRA8888 value() const { return m_value; }
468470

469471
constexpr bool operator==(Color other) const
470472
{
@@ -595,12 +597,12 @@ class Color {
595597
}
596598

597599
private:
598-
constexpr explicit Color(ARGB32 argb)
600+
constexpr explicit Color(BGRA8888 argb)
599601
: m_value(argb)
600602
{
601603
}
602604

603-
ARGB32 m_value { 0 };
605+
BGRA8888 m_value { 0 };
604606
};
605607

606608
constexpr Color::Color(NamedColor named)
@@ -695,41 +697,41 @@ constexpr Color Color::branded_color(BrandedColor color)
695697
{
696698
// clang-format off
697699
switch (color) {
698-
case BrandedColor::Indigo10: return from_rgb(0xa5'a6'f2);
699-
case BrandedColor::Indigo20: return from_rgb(0x8a'88'eb);
700-
case BrandedColor::Indigo30: return from_rgb(0x68'51'd6);
701-
case BrandedColor::Indigo40: return from_rgb(0x55'3f'c4);
702-
case BrandedColor::Indigo50: return from_rgb(0x4d'37'b8);
703-
case BrandedColor::Indigo60: return from_rgb(0x3c'28'a1);
704-
case BrandedColor::Indigo80: return from_rgb(0x30'1f'82);
705-
case BrandedColor::Indigo100: return from_rgb(0x2a'13'73);
706-
case BrandedColor::Indigo300: return from_rgb(0x26'0f'73);
707-
case BrandedColor::Indigo500: return from_rgb(0x1d'0c'59);
708-
case BrandedColor::Indigo900: return from_rgb(0x19'0c'4a);
709-
710-
case BrandedColor::Violet10: return from_rgb(0xe0'd4'ff);
711-
case BrandedColor::Violet20: return from_rgb(0xca'b5'ff);
712-
case BrandedColor::Violet30: return from_rgb(0xc3'ab'ff);
713-
case BrandedColor::Violet40: return from_rgb(0xb4'96'ff);
714-
case BrandedColor::Violet50: return from_rgb(0xab'8e'f5);
715-
case BrandedColor::Violet60: return from_rgb(0x9d'7c'f2);
716-
case BrandedColor::Violet80: return from_rgb(0x93'6f'ed);
717-
case BrandedColor::Violet100: return from_rgb(0x8a'64'e5);
718-
case BrandedColor::Violet300: return from_rgb(0x82'57'e6);
719-
case BrandedColor::Violet500: return from_rgb(0x7a'4c'e6);
720-
case BrandedColor::Violet900: return from_rgb(0x6a'39'db);
721-
722-
case BrandedColor::SlateBlue10: return from_rgb(0xcb'e0'f7);
723-
case BrandedColor::SlateBlue20: return from_rgb(0xc1'd9'f5);
724-
case BrandedColor::SlateBlue30: return from_rgb(0xb6'd2'f2);
725-
case BrandedColor::SlateBlue40: return from_rgb(0xa8'c8'ed);
726-
case BrandedColor::SlateBlue50: return from_rgb(0x97'bc'e6);
727-
case BrandedColor::SlateBlue60: return from_rgb(0x86'ad'd9);
728-
case BrandedColor::SlateBlue80: return from_rgb(0x77'a1'd1);
729-
case BrandedColor::SlateBlue100: return from_rgb(0x6d'98'cc);
730-
case BrandedColor::SlateBlue300: return from_rgb(0x5c'8e'cc);
731-
case BrandedColor::SlateBlue500: return from_rgb(0x54'84'bf);
732-
case BrandedColor::SlateBlue900: return from_rgb(0x48'72'a3);
700+
case BrandedColor::Indigo10: return from_bgrx(0xa5'a6'f2);
701+
case BrandedColor::Indigo20: return from_bgrx(0x8a'88'eb);
702+
case BrandedColor::Indigo30: return from_bgrx(0x68'51'd6);
703+
case BrandedColor::Indigo40: return from_bgrx(0x55'3f'c4);
704+
case BrandedColor::Indigo50: return from_bgrx(0x4d'37'b8);
705+
case BrandedColor::Indigo60: return from_bgrx(0x3c'28'a1);
706+
case BrandedColor::Indigo80: return from_bgrx(0x30'1f'82);
707+
case BrandedColor::Indigo100: return from_bgrx(0x2a'13'73);
708+
case BrandedColor::Indigo300: return from_bgrx(0x26'0f'73);
709+
case BrandedColor::Indigo500: return from_bgrx(0x1d'0c'59);
710+
case BrandedColor::Indigo900: return from_bgrx(0x19'0c'4a);
711+
712+
case BrandedColor::Violet10: return from_bgrx(0xe0'd4'ff);
713+
case BrandedColor::Violet20: return from_bgrx(0xca'b5'ff);
714+
case BrandedColor::Violet30: return from_bgrx(0xc3'ab'ff);
715+
case BrandedColor::Violet40: return from_bgrx(0xb4'96'ff);
716+
case BrandedColor::Violet50: return from_bgrx(0xab'8e'f5);
717+
case BrandedColor::Violet60: return from_bgrx(0x9d'7c'f2);
718+
case BrandedColor::Violet80: return from_bgrx(0x93'6f'ed);
719+
case BrandedColor::Violet100: return from_bgrx(0x8a'64'e5);
720+
case BrandedColor::Violet300: return from_bgrx(0x82'57'e6);
721+
case BrandedColor::Violet500: return from_bgrx(0x7a'4c'e6);
722+
case BrandedColor::Violet900: return from_bgrx(0x6a'39'db);
723+
724+
case BrandedColor::SlateBlue10: return from_bgrx(0xcb'e0'f7);
725+
case BrandedColor::SlateBlue20: return from_bgrx(0xc1'd9'f5);
726+
case BrandedColor::SlateBlue30: return from_bgrx(0xb6'd2'f2);
727+
case BrandedColor::SlateBlue40: return from_bgrx(0xa8'c8'ed);
728+
case BrandedColor::SlateBlue50: return from_bgrx(0x97'bc'e6);
729+
case BrandedColor::SlateBlue60: return from_bgrx(0x86'ad'd9);
730+
case BrandedColor::SlateBlue80: return from_bgrx(0x77'a1'd1);
731+
case BrandedColor::SlateBlue100: return from_bgrx(0x6d'98'cc);
732+
case BrandedColor::SlateBlue300: return from_bgrx(0x5c'8e'cc);
733+
case BrandedColor::SlateBlue500: return from_bgrx(0x54'84'bf);
734+
case BrandedColor::SlateBlue900: return from_bgrx(0x48'72'a3);
733735
}
734736
// clang-format on
735737

Libraries/LibGfx/ImageFormats/ExifOrientedBitmap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ExifOrientedBitmap {
3232
return ExifOrientedBitmap(move(bitmap), size, orientation);
3333
}
3434

35-
template<OneOf<ARGB32, CMYK> Value>
35+
template<OneOf<BGRA8888, CMYK> Value>
3636
void set_pixel(u32 x, u32 y, Value color)
3737
{
3838
auto const new_position = oriented_position(IntPoint(x, y));

Libraries/LibGfx/ImageFormats/GIFLoader.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ static void clear_rect(Bitmap& bitmap, IntRect const& rect, Color color)
124124
if (intersection_rect.is_empty())
125125
return;
126126

127-
ARGB32* dst = bitmap.scanline(intersection_rect.top()) + intersection_rect.left();
128-
size_t const dst_skip = bitmap.pitch() / sizeof(ARGB32);
127+
BGRA8888* dst = bitmap.scanline(intersection_rect.top()) + intersection_rect.left();
128+
size_t const dst_skip = bitmap.pitch() / sizeof(BGRA8888);
129129

130130
auto const value = color.value();
131131
auto const width = intersection_rect.width();
132132
for (int i = intersection_rect.height() - 1; i >= 0; --i) {
133-
for (ARGB32* p = dst; p < (dst + width); ++p) {
133+
for (BGRA8888* p = dst; p < (dst + width); ++p) {
134134
*p = value;
135135
}
136136
dst += dst_skip;

Libraries/LibGfx/ImageFormats/WebPWriterLossless.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct IsOpaque {
3939
NEVER_INLINE static ErrorOr<void> write_image_data(LittleEndianOutputBitStream& bit_stream, Bitmap const& bitmap, PrefixCodeGroup const& prefix_code_group)
4040
{
4141
// This is currently the hot loop. Keep performance in mind when you change it.
42-
for (ARGB32 pixel : bitmap) {
42+
for (BGRA8888 pixel : bitmap) {
4343
u8 a = pixel >> 24;
4444
u8 r = pixel >> 16;
4545
u8 g = pixel >> 8;
@@ -275,7 +275,7 @@ static ErrorOr<void> write_VP8L_coded_image(ImageKind image_kind, LittleEndianOu
275275
// FIXME: Consider using a meta-prefix image and using one prefix-code-group per tile.
276276

277277
Array<Array<u16, 256>, 4> symbol_frequencies {};
278-
for (ARGB32 pixel : bitmap) {
278+
for (BGRA8888 pixel : bitmap) {
279279
static constexpr auto saturating_increment = [](u16& value) {
280280
if (value < UINT16_MAX)
281281
value++;
@@ -322,10 +322,10 @@ static ErrorOr<void> write_VP8L_coded_image(ImageKind image_kind, LittleEndianOu
322322
return {};
323323
}
324324

325-
static ARGB32 sub_argb32(ARGB32 a, ARGB32 b)
325+
static BGRA8888 sub_argb32(BGRA8888 a, BGRA8888 b)
326326
{
327-
auto a_color = Color::from_argb(a);
328-
auto b_color = Color::from_argb(b);
327+
auto a_color = Color::from_bgra(a);
328+
auto b_color = Color::from_bgra(b);
329329
return Color(a_color.red() - b_color.red(),
330330
a_color.green() - b_color.green(),
331331
a_color.blue() - b_color.blue(),
@@ -337,10 +337,10 @@ static ErrorOr<NonnullRefPtr<Bitmap const>> maybe_write_color_indexing_transform
337337
{
338338
// https://developers.google.com/speed/webp/docs/webp_lossless_bitstream_specification#44_color_indexing_transform
339339
unsigned color_table_size = 0;
340-
HashTable<ARGB32> seen_colors;
341-
ARGB32 channels = 0;
342-
ARGB32 first_pixel = bitmap->get_pixel(0, 0).value();
343-
for (ARGB32 pixel : *bitmap) {
340+
HashTable<BGRA8888> seen_colors;
341+
BGRA8888 channels = 0;
342+
BGRA8888 first_pixel = bitmap->get_pixel(0, 0).value();
343+
for (BGRA8888 pixel : *bitmap) {
344344
auto result = seen_colors.set(pixel);
345345
if (result == HashSetResult::InsertedNewEntry) {
346346
++color_table_size;
@@ -377,21 +377,21 @@ static ErrorOr<NonnullRefPtr<Bitmap const>> maybe_write_color_indexing_transform
377377
TRY(bit_stream.write_bits(color_table_size - 1, 8u));
378378

379379
// Store color index to bit stream.
380-
Vector<ARGB32, 256> colors;
381-
for (ARGB32 color : seen_colors)
380+
Vector<BGRA8888, 256> colors;
381+
for (BGRA8888 color : seen_colors)
382382
colors.append(color);
383383
quick_sort(colors.begin(), colors.end());
384384

385385
// "The color table is stored using the image storage format itself." [...]
386386
// "The color table is always subtraction-coded to reduce image entropy."
387387
auto color_index_bitmap = TRY(Bitmap::create(BitmapFormat::BGRA8888, { static_cast<int>(color_table_size), 1 }));
388-
color_index_bitmap->set_pixel(0, 0, Color::from_argb(colors[0]));
388+
color_index_bitmap->set_pixel(0, 0, Color::from_bgra(colors[0]));
389389
for (unsigned i = 1; i < color_table_size; ++i)
390-
color_index_bitmap->set_pixel(i, 0, Color::from_argb(sub_argb32(colors[i], colors[i - 1])));
390+
color_index_bitmap->set_pixel(i, 0, Color::from_bgra(sub_argb32(colors[i], colors[i - 1])));
391391
TRY(write_VP8L_coded_image(ImageKind::EntropyCoded, bit_stream, *color_index_bitmap, is_fully_opaque));
392392

393393
// Return a new bitmap with the color indexing transform applied.
394-
HashMap<ARGB32, u8> color_index_map;
394+
HashMap<BGRA8888, u8> color_index_map;
395395
for (unsigned i = 0; i < color_table_size; ++i)
396396
color_index_map.set(colors[i], i);
397397

Libraries/LibGfx/Palette.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class PaletteImpl : public RefCounted<PaletteImpl> {
2828
Color color(ColorRole role) const
2929
{
3030
VERIFY((int)role < (int)ColorRole::__Count);
31-
return Color::from_argb(theme().color[(int)role]);
31+
return Color::from_bgra(theme().color[(int)role]);
3232
}
3333

3434
Gfx::TextAlignment alignment(AlignmentRole role) const

0 commit comments

Comments
 (0)