1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

Userland: Use Rect::centered_within() where useful

This commit is contained in:
Andreas Kling 2021-08-30 22:18:20 +02:00
parent 43220568b0
commit 087bd7f767
9 changed files with 15 additions and 34 deletions

View file

@ -126,8 +126,7 @@ void MonitorWidget::redraw_desktop_if_needed()
auto scaled_bitmap = m_wallpaper_bitmap->scaled(sw, sh);
if (m_desktop_wallpaper_mode == "center") {
Gfx::IntRect centered_rect { {}, scaled_size };
centered_rect.center_within(m_desktop_bitmap->rect());
auto centered_rect = Gfx::IntRect({}, scaled_size).centered_within(m_desktop_bitmap->rect());
painter.blit(centered_rect.location(), *scaled_bitmap, scaled_bitmap->rect());
} else if (m_desktop_wallpaper_mode == "tile") {
painter.draw_tiled_bitmap(m_desktop_bitmap->rect(), *scaled_bitmap);