mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 18:15:07 +00:00
WindowSerer+LibGUI: Send multiple rects in invalidation/flush messages.
This patch moves to sending up to 32 rects at a time when coordinating the painting between WindowServer and its clients. Rects are also merged into a minimal DisjointRectSet on the server side before painting. Interactive resize looks a lot better after this change, since we can usually do all the repainting needed in one go.
This commit is contained in:
parent
ec365b82d5
commit
7efd61fcf5
10 changed files with 74 additions and 29 deletions
|
@ -302,13 +302,15 @@ void GWindow::update(const Rect& a_rect)
|
|||
|
||||
if (m_pending_paint_event_rects.is_empty()) {
|
||||
deferred_invoke([this] (auto&) {
|
||||
for (auto& rect : m_pending_paint_event_rects) {
|
||||
WSAPI_ClientMessage request;
|
||||
request.type = WSAPI_ClientMessage::Type::InvalidateRect;
|
||||
request.window_id = m_window_id;
|
||||
request.window.rect = rect;
|
||||
GEventLoop::current().post_message_to_server(request);
|
||||
}
|
||||
// FIXME: Break it into multiple batches if needed.
|
||||
ASSERT(m_pending_paint_event_rects.size() <= 32);
|
||||
WSAPI_ClientMessage request;
|
||||
request.type = WSAPI_ClientMessage::Type::InvalidateRect;
|
||||
request.window_id = m_window_id;
|
||||
for (int i = 0; i < m_pending_paint_event_rects.size(); ++i)
|
||||
request.rects[i] = m_pending_paint_event_rects[i];
|
||||
request.rect_count = m_pending_paint_event_rects.size();
|
||||
GEventLoop::current().post_message_to_server(request);
|
||||
m_pending_paint_event_rects.clear_with_capacity();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue