1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 16:18: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

@ -119,7 +119,7 @@ Fire::Fire()
/* Draw fire "source" on bottom row of pixels */
for (int i = 0; i < FIRE_WIDTH; i++)
bitmap->bits(bitmap->height() - 1)[i] = FIRE_MAX;
bitmap->scanline_u8(bitmap->height() - 1)[i] = FIRE_MAX;
/* Set off initital paint event */
//update();
@ -157,7 +157,7 @@ void Fire::timer_event(Core::TimerEvent&)
int rnd = rand() % 3;
/* Calculate new pixel value, don't go below 0 */
u8 nv = bitmap->bits(py)[px];
u8 nv = bitmap->scanline_u8(py)[px];
if (nv > 0)
nv -= (rnd & 1);
@ -168,7 +168,7 @@ void Fire::timer_event(Core::TimerEvent&)
else if (epx > FIRE_WIDTH)
epx = FIRE_WIDTH;
bitmap->bits(py - 1)[epx] = nv;
bitmap->scanline_u8(py - 1)[epx] = nv;
}
}
@ -199,10 +199,10 @@ void Fire::mousemove_event(GUI::MouseEvent& event)
if (event.y() >= 2 && event.y() < 398 && event.x() <= 638) {
int ypos = event.y() / 2;
int xpos = event.x() / 2;
bitmap->bits(ypos - 1)[xpos] = FIRE_MAX + 5;
bitmap->bits(ypos - 1)[xpos + 1] = FIRE_MAX + 5;
bitmap->bits(ypos)[xpos] = FIRE_MAX + 5;
bitmap->bits(ypos)[xpos + 1] = FIRE_MAX + 5;
bitmap->scanline_u8(ypos - 1)[xpos] = FIRE_MAX + 5;
bitmap->scanline_u8(ypos - 1)[xpos + 1] = FIRE_MAX + 5;
bitmap->scanline_u8(ypos)[xpos] = FIRE_MAX + 5;
bitmap->scanline_u8(ypos)[xpos + 1] = FIRE_MAX + 5;
}
}