summaryrefslogtreecommitdiffstats
path: root/libs/hwui/Rect.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/Rect.h')
-rw-r--r--libs/hwui/Rect.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/libs/hwui/Rect.h b/libs/hwui/Rect.h
index fb76717..fff9f6c 100644
--- a/libs/hwui/Rect.h
+++ b/libs/hwui/Rect.h
@@ -112,7 +112,8 @@ public:
}
bool intersect(float l, float t, float r, float b) {
- Rect tmp(intersectWith(l, t, r, b));
+ Rect tmp(l, t, r, b);
+ intersectWith(tmp);
if (!tmp.isEmpty()) {
set(tmp);
return true;
@@ -173,6 +174,13 @@ private:
static inline float min(float a, float b) { return (a < b) ? a : b; }
static inline float max(float a, float b) { return (a > b) ? a : b; }
+ void intersectWith(Rect& tmp) const {
+ tmp.left = max(left, tmp.left);
+ tmp.top = max(top, tmp.top);
+ tmp.right = min(right, tmp.right);
+ tmp.bottom = min(bottom, tmp.bottom);
+ }
+
Rect intersectWith(float l, float t, float r, float b) const {
Rect tmp;
tmp.left = max(left, l);