1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:58:12 +00:00

WindowServer: Give windows a "background color" to use for missing parts.

When resizing a window, we often end up having to paint some part of it
without coverage in the current backing store. This patch makes those cases
look nicer by having a fallback background color for each window, passed
along with the CreateWindow client message.
This commit is contained in:
Andreas Kling 2019-04-10 14:29:47 +02:00
parent 30e2d62c38
commit d4818dd2dd
9 changed files with 30 additions and 2 deletions

View file

@ -819,7 +819,20 @@ void WSWindowManager::compose()
dirty_rect_in_window_coordinates.move_by(-window.position());
auto dst = window.position();
dst.move_by(dirty_rect_in_window_coordinates.location());
m_back_painter->fill_rect(window.rect(), window.background_color());
m_back_painter->blit(dst, *backing_store, dirty_rect_in_window_coordinates, window.opacity());
if (backing_store->width() < window.width()) {
Rect right_fill_rect { window.x() + backing_store->width(), window.y(), window.width() - backing_store->width(), window.height() };
m_back_painter->fill_rect(right_fill_rect, window.background_color());
}
if (backing_store->height() < window.height()) {
Rect bottom_fill_rect { window.x(), window.y() + backing_store->height(), window.width(), window.height() - backing_store->height() };
m_back_painter->fill_rect(bottom_fill_rect, window.background_color());
}
}
return IterationDecision::Continue;
});