diff options
author | Tom <tomut@yahoo.com> | 2021-02-15 20:05:49 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-25 18:04:06 +0100 |
commit | cd0a1fa5b0d5b0dd245d384caecbc2500d9bdab7 (patch) | |
tree | 2339e38c3d72c027cbff87a64cfff9e0a85ce2f6 /Userland/Libraries/LibGUI/Window.cpp | |
parent | 3907bacfcdb8878a218fccad13705004aeac5cb2 (diff) | |
download | serenity-cd0a1fa5b0d5b0dd245d384caecbc2500d9bdab7.zip |
LibGUI: Avoid needlessly copying vectors of rects
Diffstat (limited to 'Userland/Libraries/LibGUI/Window.cpp')
-rw-r--r-- | Userland/Libraries/LibGUI/Window.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp index 1ad24ded63..a088d96db2 100644 --- a/Userland/Libraries/LibGUI/Window.cpp +++ b/Userland/Libraries/LibGUI/Window.cpp @@ -416,12 +416,8 @@ void Window::handle_multi_paint_event(MultiPaintEvent& event) else if (created_new_backing_store) set_current_backing_store(*m_back_store, true); - if (is_visible()) { - Vector<Gfx::IntRect> rects_to_send; - for (auto& r : rects) - rects_to_send.append(r); - WindowServerConnection::the().post_message(Messages::WindowServer::DidFinishPainting(m_window_id, rects_to_send)); - } + if (is_visible()) + WindowServerConnection::the().post_message(Messages::WindowServer::DidFinishPainting(m_window_id, rects)); } 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); if (rects.is_empty()) return; - Vector<Gfx::IntRect> rects_to_send; - for (auto& r : rects) - rects_to_send.append(r); - WindowServerConnection::the().post_message(Messages::WindowServer::InvalidateRect(m_window_id, rects_to_send, false)); + WindowServerConnection::the().post_message(Messages::WindowServer::InvalidateRect(m_window_id, rects, false)); }); } m_pending_paint_event_rects.append(a_rect); |