mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 22:58:12 +00:00
WindowServer: Skip composing windows where entire dirty rect is covered.
If another window is currently in front of us and is fully opaque, we can just skip to the next window. This avoids a whole lot of painting with overlapping windows. :^)
This commit is contained in:
parent
963e95cb1a
commit
272a41d02d
1 changed files with 16 additions and 0 deletions
|
@ -871,6 +871,20 @@ void WSWindowManager::compose()
|
|||
return false;
|
||||
};
|
||||
|
||||
auto any_opaque_window_above_this_one_contains_rect = [this] (const WSWindow& a_window, const Rect& r) {
|
||||
for (auto* window = a_window.next(); window; window = window->next()) {
|
||||
if (!window->is_visible())
|
||||
continue;
|
||||
if (window->opacity() < 1.0f)
|
||||
continue;
|
||||
if (window->has_alpha_channel())
|
||||
continue;
|
||||
if (outer_window_rect(*window).contains(r))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
auto any_dirty_rect_intersects_window = [&dirty_rects] (const WSWindow& window) {
|
||||
auto window_rect = outer_window_rect(window);
|
||||
for (auto& dirty_rect : dirty_rects.rects()) {
|
||||
|
@ -898,6 +912,8 @@ void WSWindowManager::compose()
|
|||
PainterStateSaver saver(*m_back_painter);
|
||||
m_back_painter->set_clip_rect(outer_window_rect(window));
|
||||
for (auto& dirty_rect : dirty_rects.rects()) {
|
||||
if (any_opaque_window_above_this_one_contains_rect(window, dirty_rect))
|
||||
continue;
|
||||
PainterStateSaver saver(*m_back_painter);
|
||||
m_back_painter->set_clip_rect(dirty_rect);
|
||||
paint_window_frame(window);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue