1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:48:12 +00:00

LibGfx: Remove redundant bits() method

In all circumstances, this returned exactly the same thing as scanline_u8(),
so let's just remove the silly detour.

This does not add any new dependency on Bitmap-internals, because that already existed.
This commit is contained in:
Ben Wiederhake 2020-09-06 01:10:33 +02:00 committed by Andreas Kling
parent 25ccd40d5a
commit d6673b384e
4 changed files with 17 additions and 30 deletions

View file

@ -51,13 +51,13 @@ template<BitmapFormat format = BitmapFormat::Invalid>
ALWAYS_INLINE Color get_pixel(const Gfx::Bitmap& bitmap, int x, int y)
{
if constexpr (format == BitmapFormat::Indexed8)
return bitmap.palette_color(bitmap.bits(y)[x]);
return bitmap.palette_color(bitmap.scanline_u8(y)[x]);
if constexpr (format == BitmapFormat::Indexed4)
return bitmap.palette_color(bitmap.bits(y)[x]);
return bitmap.palette_color(bitmap.scanline_u8(y)[x]);
if constexpr (format == BitmapFormat::Indexed2)
return bitmap.palette_color(bitmap.bits(y)[x]);
return bitmap.palette_color(bitmap.scanline_u8(y)[x]);
if constexpr (format == BitmapFormat::Indexed1)
return bitmap.palette_color(bitmap.bits(y)[x]);
return bitmap.palette_color(bitmap.scanline_u8(y)[x]);
if constexpr (format == BitmapFormat::RGB32)
return Color::from_rgb(bitmap.scanline(y)[x]);
if constexpr (format == BitmapFormat::RGBA32)
@ -678,7 +678,7 @@ void Painter::blit(const IntPoint& position, const Gfx::Bitmap& source, const In
}
if (Bitmap::is_indexed(source.format())) {
const u8* src = source.bits(src_rect.top() + first_row) + src_rect.left() + first_column;
const u8* src = source.scanline_u8(src_rect.top() + first_row) + src_rect.left() + first_column;
const size_t src_skip = source.pitch();
for (int row = first_row; row <= last_row; ++row) {
for (int i = 0; i < clipped_rect.width(); ++i)