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

WindowServer: Improve screen invalidation on window state changes

Because window states and various flags can affect the windows'
rendered areas it's safer to use the last computed occlusion rectangles
to invalidate areas on the screen that may have to be re-rendered due
to e.g. a window size change.

Fixes #6723
This commit is contained in:
Tom 2021-07-04 15:47:17 -06:00 committed by Andreas Kling
parent 7fdf902e4a
commit fdf701ed96
6 changed files with 85 additions and 45 deletions

View file

@ -598,25 +598,7 @@ void WindowFrame::window_rect_changed(const Gfx::IntRect& old_rect, const Gfx::I
{
layout_buttons();
auto new_frame_rect = constrained_render_rect_to_screen(frame_rect_for_window(m_window, new_rect));
set_dirty(true);
auto& compositor = Compositor::the();
{
// Invalidate the areas outside of the new rect. Use the last computed occlusions for this purpose
// as we can't reliably calculate the previous frame rect anymore. The window state (e.g. maximized
// or tiled) may affect the calculations and it may have already been changed by the time we get
// called here.
auto invalidate_opaque = m_window.opaque_rects().shatter(new_frame_rect);
for (auto& rect : invalidate_opaque.rects())
compositor.invalidate_screen(rect);
auto invalidate_transparent = m_window.transparency_rects().shatter(new_frame_rect);
for (auto& rect : invalidate_transparent.rects())
compositor.invalidate_screen(rect);
}
compositor.invalidate_occlusions();
WindowManager::the().notify_rect_changed(m_window, old_rect, new_rect);
}