1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:57:35 +00:00

LibGfx: Make Painter take the scale factor as constructor argument

I want to give Bitmap an intrinsic scale factor and this is a step
in that direction.

No behavior change.
This commit is contained in:
Nico Weber 2021-01-17 09:46:55 -05:00 committed by Andreas Kling
parent 7a0bc2fdb8
commit 1382bbfc57
4 changed files with 12 additions and 14 deletions

View file

@ -68,13 +68,16 @@ ALWAYS_INLINE Color get_pixel(const Gfx::Bitmap& bitmap, int x, int y)
return bitmap.get_pixel(x, y);
}
Painter::Painter(Gfx::Bitmap& bitmap)
Painter::Painter(Gfx::Bitmap& bitmap, int scale)
: m_target(bitmap)
{
ASSERT(bitmap.format() == Gfx::BitmapFormat::RGB32 || bitmap.format() == Gfx::BitmapFormat::RGBA32);
ASSERT(bitmap.width() % scale == 0);
ASSERT(bitmap.height() % scale == 0);
m_state_stack.append(State());
state().font = &FontDatabase::default_font();
state().clip_rect = { { 0, 0 }, bitmap.size() };
state().scale = scale;
m_clip_origin = state().clip_rect;
}