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

LibGUI: Avoid needlessly copying vectors of rects

This commit is contained in:
Tom 2021-02-15 20:05:49 -07:00 committed by Andreas Kling
parent 3907bacfcd
commit cd0a1fa5b0

View file

@ -416,12 +416,8 @@ void Window::handle_multi_paint_event(MultiPaintEvent& event)
else if (created_new_backing_store) else if (created_new_backing_store)
set_current_backing_store(*m_back_store, true); set_current_backing_store(*m_back_store, true);
if (is_visible()) { if (is_visible())
Vector<Gfx::IntRect> rects_to_send; WindowServerConnection::the().post_message(Messages::WindowServer::DidFinishPainting(m_window_id, rects));
for (auto& r : rects)
rects_to_send.append(r);
WindowServerConnection::the().post_message(Messages::WindowServer::DidFinishPainting(m_window_id, rects_to_send));
}
} }
void Window::handle_key_event(KeyEvent& event) void Window::handle_key_event(KeyEvent& event)
@ -606,10 +602,7 @@ void Window::update(const Gfx::IntRect& a_rect)
auto rects = move(m_pending_paint_event_rects); auto rects = move(m_pending_paint_event_rects);
if (rects.is_empty()) if (rects.is_empty())
return; return;
Vector<Gfx::IntRect> rects_to_send; WindowServerConnection::the().post_message(Messages::WindowServer::InvalidateRect(m_window_id, rects, false));
for (auto& r : rects)
rects_to_send.append(r);
WindowServerConnection::the().post_message(Messages::WindowServer::InvalidateRect(m_window_id, rects_to_send, false));
}); });
} }
m_pending_paint_event_rects.append(a_rect); m_pending_paint_event_rects.append(a_rect);