diff options
author | Pablo Ceballos | 2016-03-09 19:19:22 -0600 |
---|---|---|
committer | Pablo Ceballos | 2016-03-09 19:19:22 -0600 |
commit | 19d72c06ac2bc2f57609a4eed3b228f1b4efae8a (patch) | |
tree | 2106cd0624ed09c1deb367c4614ac45057db0014 /libs | |
parent | 99dccfc3ec4b304d1ee3497ecbcc3322a84cf606 (diff) | |
download | frameworks-native-19d72c06ac2bc2f57609a4eed3b228f1b4efae8a.tar.gz frameworks-native-19d72c06ac2bc2f57609a4eed3b228f1b4efae8a.tar.xz frameworks-native-19d72c06ac2bc2f57609a4eed3b228f1b4efae8a.zip |
ui: Fix Rect::reduce
- Properly handle the case where the Rect to be excluded is completely
outside the other Rect.
Bug 27415039
Change-Id: I3331d5b3ab231d023348079c781b194d24ac37dd
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ui/Rect.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libs/ui/Rect.cpp b/libs/ui/Rect.cpp index 99cbedc2f..d8702e575 100644 --- a/libs/ui/Rect.cpp +++ b/libs/ui/Rect.cpp | |||
@@ -127,13 +127,13 @@ Rect Rect::reduce(const Rect& exclude) const { | |||
127 | if (!(mask & (mask - 1))) { | 127 | if (!(mask & (mask - 1))) { |
128 | // power-of-2, i.e.: just one bit is set | 128 | // power-of-2, i.e.: just one bit is set |
129 | if (mask & 1) { | 129 | if (mask & 1) { |
130 | result.right = exclude.left; | 130 | result.right = min(result.right, exclude.left); |
131 | } else if (mask & 2) { | 131 | } else if (mask & 2) { |
132 | result.bottom = exclude.top; | 132 | result.bottom = min(result.bottom, exclude.top); |
133 | } else if (mask & 4) { | 133 | } else if (mask & 4) { |
134 | result.left = exclude.right; | 134 | result.left = max(result.left, exclude.right); |
135 | } else if (mask & 8) { | 135 | } else if (mask & 8) { |
136 | result.top = exclude.bottom; | 136 | result.top = max(result.top, exclude.bottom); |
137 | } | 137 | } |
138 | } | 138 | } |
139 | } | 139 | } |