fix Region const_iterator.
- it returned an empty rect when the region was empty, instead
of returning an empty list of rect.
- also fixed an infinite loop when boolean_operation was given
an empty list of rects
Change-Id: I62225c7dcd2832025bb8f12e6cb3762f2a7b36cb
diff --git a/libs/ui/Region.cpp b/libs/ui/Region.cpp
index 6e2e731..2c7cdf0 100644
--- a/libs/ui/Region.cpp
+++ b/libs/ui/Region.cpp
@@ -619,7 +619,15 @@
}
Region::const_iterator Region::end() const {
- return isRect() ? ((&mBounds) + 1) : (mStorage.array() + mStorage.size());
+ if (isRect()) {
+ if (isEmpty()) {
+ return &mBounds;
+ } else {
+ return &mBounds + 1;
+ }
+ } else {
+ return mStorage.array() + mStorage.size();
+ }
}
Rect const* Region::getArray(size_t* count) const {