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

LibGfx: Implement blit_offset() in terms of blit()

It's less code, and blit() already handles scaled painters.

Fixes the window server asserting in highdpi mode with a centered
background image. Part of #5017.
This commit is contained in:
Nico Weber 2021-01-22 11:12:00 -05:00 committed by Andreas Kling
parent 586c0aa043
commit 2fe6a313c2
3 changed files with 15 additions and 38 deletions

View file

@ -257,10 +257,8 @@ void Compositor::compose()
if (m_wallpaper_mode == WallpaperMode::Simple) {
painter.blit(rect.location(), *m_wallpaper, rect);
} else if (m_wallpaper_mode == WallpaperMode::Center) {
Gfx::IntPoint offset { ws.size().width() / 2 - m_wallpaper->size().width() / 2,
ws.size().height() / 2 - m_wallpaper->size().height() / 2 };
painter.blit_offset(rect.location(), *m_wallpaper,
rect, offset);
Gfx::IntPoint offset { (ws.width() - m_wallpaper->width()) / 2, (ws.height() - m_wallpaper->height()) / 2 };
painter.blit_offset(rect.location(), *m_wallpaper, rect, offset);
} else if (m_wallpaper_mode == WallpaperMode::Tile) {
painter.draw_tiled_bitmap(rect, *m_wallpaper);
} else if (m_wallpaper_mode == WallpaperMode::Stretch) {