From e5fc2ca9008a4144ae9f552a13d24e2dafbf9953 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 12 Jan 2019 16:46:57 +0100 Subject: [PATCH] WindowManager::invalidate() can just use Rect::intersection(). --- Widgets/WindowManager.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/Widgets/WindowManager.cpp b/Widgets/WindowManager.cpp index ceb863e174..167a36195a 100644 --- a/Widgets/WindowManager.cpp +++ b/Widgets/WindowManager.cpp @@ -320,17 +320,7 @@ void WindowManager::invalidate() void WindowManager::invalidate(const Rect& a_rect) { - // FIXME: This code is fugly. - Rect rect(a_rect); - auto screen_rect = AbstractScreen::the().rect(); - if (rect.left() < 0) - rect.set_left(0); - if (rect.top() < 0) - rect.set_top(0); - if (rect.right() > screen_rect.right()) - rect.set_right(screen_rect.right()); - if (rect.bottom() > screen_rect.bottom()) - rect.set_bottom(screen_rect.bottom()); + auto rect = Rect::intersection(a_rect, AbstractScreen::the().rect()); if (rect.is_empty()) return; for (auto& r : m_invalidated_rects) {