summaryrefslogtreecommitdiffstats
path: root/libs/ui
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-04-16 18:40:30 -0700
committerMathias Agopian <mathias@google.com>2012-04-16 18:40:30 -0700
commit3aecbb0715cb6928e0530ff1e4caa9c0993cc371 (patch)
treefa74d2ee33fab79da3a3c96b3a4721f6949392a6 /libs/ui
parent0c8ecacb370b5f7ee6f0fc1fb2ae978f9b670c6d (diff)
downloadframeworks_native-3aecbb0715cb6928e0530ff1e4caa9c0993cc371.zip
frameworks_native-3aecbb0715cb6928e0530ff1e4caa9c0993cc371.tar.gz
frameworks_native-3aecbb0715cb6928e0530ff1e4caa9c0993cc371.tar.bz2
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')
-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 6e2e731..2c7cdf0 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 {