From c527a4e0e443dd2821664f89ec343501bd710f4c Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 17 Sep 2024 17:27:22 +0200 Subject: [PATCH] util/dirty_rect.h: accessor for empty state Provide an easy way to check for the absence of any dirty pixels. Issue #5344 --- repos/os/include/util/dirty_rect.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/repos/os/include/util/dirty_rect.h b/repos/os/include/util/dirty_rect.h index 4c72935c94..c33af9b27f 100644 --- a/repos/os/include/util/dirty_rect.h +++ b/repos/os/include/util/dirty_rect.h @@ -136,6 +136,15 @@ class Genode::Dirty_rect rect = rect.valid() ? Rect::compound(rect, added) : added; } + + bool empty() const + { + for (unsigned i = 0; i < NUM_RECTS; i++) + if (_rects[i].area.count()) + return false; + + return true; + } }; #endif /* _INCLUDE__UTIL__DIRTY_RECT_H_ */