summaryrefslogtreecommitdiff
path: root/libs/ui/Region.cpp
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2012-04-16 18:40:30 -0700
committer Mathias Agopian <mathias@google.com> 2012-04-16 18:40:30 -0700
commit3aecbb0715cb6928e0530ff1e4caa9c0993cc371 (patch)
treefa74d2ee33fab79da3a3c96b3a4721f6949392a6 /libs/ui/Region.cpp
parent0c8ecacb370b5f7ee6f0fc1fb2ae978f9b670c6d (diff)
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
Diffstat (limited to 'libs/ui/Region.cpp')
-rw-r--r--libs/ui/Region.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/libs/ui/Region.cpp b/libs/ui/Region.cpp
index 6e2e731e3d..2c7cdf076d 100644
--- a/libs/ui/Region.cpp
+++ b/libs/ui/Region.cpp
@@ -619,7 +619,15 @@ Region::const_iterator Region::begin() const {
}
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 {