WindowServer: Skip blitting windows into the back buffer if possible.

Windows that don't intersect any of the dirty rects don't need to be copied
into the back buffer since they won't be affected by the subsequent flushes.
This commit is contained in:
Andreas Kling 2019-01-16 20:16:50 +01:00
parent b6c3df5188
commit 61bba1b9dd
Notes: sideshowbarker 2024-07-19 16:01:15 +09:00

View file

@ -284,6 +284,15 @@ void WSWindowManager::compose()
return false;
};
auto any_dirty_rect_intersects_window = [&invalidated_rects] (const WSWindow& window) {
auto window_rect = outerRectForWindow(window.rect());
for (auto& dirty_rect : invalidated_rects) {
if (dirty_rect.intersects(window_rect))
return true;
}
return false;
};
for (auto& r : invalidated_rects) {
if (any_window_contains_rect(r))
continue;
@ -293,6 +302,8 @@ void WSWindowManager::compose()
for (auto* window = m_windows_in_order.head(); window; window = window->next()) {
if (!window->backing())
continue;
if (!any_dirty_rect_intersects_window(*window))
continue;
paintWindowFrame(*window);
m_back_painter->blit(window->position(), *window->backing());
}