diff options
author | Romain Guy <romainguy@google.com> | 2011-12-14 19:23:32 -0800 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2011-12-14 19:23:32 -0800 |
commit | 8f85e80b64b89fd38cc23b129f61ec36ddde7f15 (patch) | |
tree | bac2bd06357532f524277551c7606ad2471f7be8 /libs/hwui/Rect.h | |
parent | 2d4fd364843d3efc6e6ee59ccc5beb513a86d789 (diff) |
Generate even fewer GL commands
Change-Id: I0f4dcacb03ef5ee7f6ebd501df98bfead5f0a7f8
Diffstat (limited to 'libs/hwui/Rect.h')
-rw-r--r-- | libs/hwui/Rect.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libs/hwui/Rect.h b/libs/hwui/Rect.h index fb76717fbf9b..fff9f6c4d812 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); |