diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-01-12 03:07:23 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-01-12 03:07:23 +0100 |
commit | 83252397e48561b629bfc9d4c0edd774361b65f3 (patch) | |
tree | 5fcc7d97be3868b3f68e9673d1b8a83867b35875 | |
parent | d6bbd2126d4fdeffe352e4e8ce852841a41473c7 (diff) | |
download | serenity-83252397e48561b629bfc9d4c0edd774361b65f3.zip |
Ignore WindowManager invalidations inside already invalidated rects.
-rw-r--r-- | Widgets/Rect.h | 8 | ||||
-rw-r--r-- | Widgets/WindowManager.cpp | 9 |
2 files changed, 15 insertions, 2 deletions
diff --git a/Widgets/Rect.h b/Widgets/Rect.h index f5e8f773fa..1d613f691e 100644 --- a/Widgets/Rect.h +++ b/Widgets/Rect.h @@ -63,6 +63,14 @@ public: return contains(point.x(), point.y()); } + bool contains(const Rect& other) const + { + return left() <= other.left() + && right() >= other.right() + && top() <= other.top() + && bottom() >= other.bottom(); + } + int left() const { return x(); } int right() const { return x() + width() - 1; } int top() const { return y(); } diff --git a/Widgets/WindowManager.cpp b/Widgets/WindowManager.cpp index f371772a45..a3eec92928 100644 --- a/Widgets/WindowManager.cpp +++ b/Widgets/WindowManager.cpp @@ -339,8 +339,13 @@ void WindowManager::invalidate() void WindowManager::invalidate(const Rect& rect) { - if (!rect.is_empty()) - m_invalidated_rects.append(rect); + if (rect.is_empty()) + return; + for (auto& r : m_invalidated_rects) { + if (r.contains(rect)) + return; + } + m_invalidated_rects.append(rect); } void WindowManager::invalidate(const Window& window) |