summaryrefslogtreecommitdiff
path: root/Userland/Services/WindowServer/Compositor.cpp
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2021-01-17 09:46:55 -0500
committerAndreas Kling <kling@serenityos.org>2021-01-17 16:10:21 +0100
commit1382bbfc57abfc6d3e89d53c837ffefc0f72b13d (patch)
tree0703b5ae5e17ed30667d88f19fdeb54c25b993cb /Userland/Services/WindowServer/Compositor.cpp
parent7a0bc2fdb8be089c6b2fe31ed0859876470becc4 (diff)
downloadserenity-1382bbfc57abfc6d3e89d53c837ffefc0f72b13d.zip
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.
Diffstat (limited to 'Userland/Services/WindowServer/Compositor.cpp')
-rw-r--r--Userland/Services/WindowServer/Compositor.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/Userland/Services/WindowServer/Compositor.cpp b/Userland/Services/WindowServer/Compositor.cpp
index 0f64873308..0b21a51133 100644
--- a/Userland/Services/WindowServer/Compositor.cpp
+++ b/Userland/Services/WindowServer/Compositor.cpp
@@ -95,19 +95,16 @@ void Compositor::init_bitmaps()
auto physical_size = screen.physical_size();
m_front_bitmap = Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::RGB32, physical_size, screen.pitch(), screen.scanline(0));
- m_front_painter = make<Gfx::Painter>(*m_front_bitmap);
- m_front_painter->scale(screen.scale_factor());
+ m_front_painter = make<Gfx::Painter>(*m_front_bitmap, screen.scale_factor());
if (m_screen_can_set_buffer)
m_back_bitmap = Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::RGB32, physical_size, screen.pitch(), screen.scanline(physical_size.height()));
else
m_back_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, physical_size);
- m_back_painter = make<Gfx::Painter>(*m_back_bitmap);
- m_back_painter->scale(screen.scale_factor());
+ m_back_painter = make<Gfx::Painter>(*m_back_bitmap, screen.scale_factor());
m_temp_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, physical_size);
- m_temp_painter = make<Gfx::Painter>(*m_temp_bitmap);
- m_temp_painter->scale(screen.scale_factor());
+ m_temp_painter = make<Gfx::Painter>(*m_temp_bitmap, screen.scale_factor());
m_buffers_are_flipped = false;
@@ -456,7 +453,7 @@ void Compositor::compose()
{
// FIXME: Give Bitmap an intrinsic scale factor and make Painter::blit() do the right thing if both it and the passed bitmap have scale factors:
// If a 2x scaled bitmap is blitted on a 2x scaled painter, it should be blitted without scale.
- Gfx::Painter unscaled_back_painter(*m_back_bitmap);
+ Gfx::Painter unscaled_back_painter(*m_back_bitmap, 1);
auto scale = Screen::the().scale_factor();
for (auto& rect : flush_transparent_rects.rects())
unscaled_back_painter.blit(rect.location() * scale, *m_temp_bitmap, rect * scale);
@@ -825,7 +822,7 @@ void Compositor::restore_cursor_back()
// FIXME: Give Bitmap an intrinsic scale factor and make Painter::blit() do the right thing if both it and the passed bitmap have scale factors:
// If a 2x scaled bitmap is blitted on a 2x scaled painter, it should be blitted without scale.
- Gfx::Painter unscaled_back_painter(*m_back_bitmap);
+ Gfx::Painter unscaled_back_painter(*m_back_bitmap, 1);
auto last_physical_cursor_rect = (m_last_cursor_rect * Screen::the().scale_factor()).intersected(Screen::the().physical_rect());
unscaled_back_painter.blit(last_physical_cursor_rect.location(), *m_cursor_back_bitmap, { { 0, 0 }, last_physical_cursor_rect.size() });
}