mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-19 22:25:36 +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:
@@ -383,7 +383,7 @@ void WSClientConnection::handle_request(const WSAPISetWindowRectRequest& request
|
||||
}
|
||||
auto& window = *(*it).value;
|
||||
window.set_rect(request.rect());
|
||||
post_paint_request(window, request.rect());
|
||||
window.request_update(request.rect());
|
||||
}
|
||||
|
||||
void WSClientConnection::handle_request(const WSAPIGetWindowRectRequest& request)
|
||||
@@ -477,14 +477,20 @@ void WSClientConnection::handle_request(const WSAPIDestroyWindowRequest& request
|
||||
post_message(response);
|
||||
}
|
||||
|
||||
void WSClientConnection::post_paint_request(const WSWindow& window, const Rect& rect)
|
||||
void WSClientConnection::post_paint_message(WSWindow& window)
|
||||
{
|
||||
WSAPI_ServerMessage response;
|
||||
response.type = WSAPI_ServerMessage::Type::Paint;
|
||||
response.window_id = window.window_id();
|
||||
response.paint.rect = rect;
|
||||
response.paint.window_size = window.size();
|
||||
post_message(response);
|
||||
WSAPI_ServerMessage message;
|
||||
message.type = WSAPI_ServerMessage::Type::Paint;
|
||||
message.window_id = window.window_id();
|
||||
auto rect_set = window.take_pending_paint_rects();
|
||||
auto& rects = rect_set.rects();
|
||||
// FIXME: Break it into multiple batches if needed.
|
||||
ASSERT(rects.size() <= 32);
|
||||
message.rect_count = rects.size();
|
||||
for (int i = 0; i < rects.size(); ++i)
|
||||
message.rects[i] = rects[i];
|
||||
message.paint.window_size = window.size();
|
||||
post_message(message);
|
||||
}
|
||||
|
||||
void WSClientConnection::handle_request(const WSAPIInvalidateRectRequest& request)
|
||||
@@ -496,7 +502,8 @@ void WSClientConnection::handle_request(const WSAPIInvalidateRectRequest& reques
|
||||
return;
|
||||
}
|
||||
auto& window = *(*it).value;
|
||||
post_paint_request(window, request.rect());
|
||||
for (int i = 0; i < request.rects().size(); ++i)
|
||||
window.request_update(request.rects()[i]);
|
||||
}
|
||||
|
||||
void WSClientConnection::handle_request(const WSAPIDidFinishPaintingNotification& request)
|
||||
|
||||
Reference in New Issue
Block a user