Region::makeBoundsSelf() efficiently turns a region to its bounds
diff --git a/include/ui/Region.h b/include/ui/Region.h
index df455a9..2bcad5b 100644
--- a/include/ui/Region.h
+++ b/include/ui/Region.h
@@ -51,6 +51,9 @@
inline Rect getBounds() const { return mBounds; }
inline Rect bounds() const { return getBounds(); }
+ // the region becomes its bounds
+ Region& makeBoundsSelf();
+
void clear();
void set(const Rect& r);
void set(uint32_t w, uint32_t h);
diff --git a/libs/ui/Region.cpp b/libs/ui/Region.cpp
index 2e6b241..b400a92 100644
--- a/libs/ui/Region.cpp
+++ b/libs/ui/Region.cpp
@@ -87,6 +87,12 @@
return *this;
}
+Region& Region::makeBoundsSelf()
+{
+ mStorage.clear();
+ return *this;
+}
+
void Region::clear()
{
mBounds.clear();