diff options
author | Romain Guy <romainguy@google.com> | 2011-12-13 14:55:06 -0800 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2011-12-13 14:58:14 -0800 |
commit | a1d3c91afbd52c7e8b01f4a9060c5459f02ae7a5 (patch) | |
tree | 25fabe19bc7667a756c27aec7b541acee0f49def /libs/hwui/Rect.h | |
parent | e829bc0f0364e942bed01536d115a5c08d25d776 (diff) | |
download | frameworks_base-a1d3c91afbd52c7e8b01f4a9060c5459f02ae7a5.zip frameworks_base-a1d3c91afbd52c7e8b01f4a9060c5459f02ae7a5.tar.gz frameworks_base-a1d3c91afbd52c7e8b01f4a9060c5459f02ae7a5.tar.bz2 |
Further reduce the number of GL commands sent to the driver
Change-Id: Id922b2a166ea4573b767c27d3195e11c70320b23
Diffstat (limited to 'libs/hwui/Rect.h')
-rw-r--r-- | libs/hwui/Rect.h | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/libs/hwui/Rect.h b/libs/hwui/Rect.h index edc90e1..adf019b 100644 --- a/libs/hwui/Rect.h +++ b/libs/hwui/Rect.h @@ -29,17 +29,6 @@ namespace uirenderer { /////////////////////////////////////////////////////////////////////////////// class Rect { - 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; } - Rect intersectWith(float l, float t, float r, float b) const { - Rect tmp; - tmp.left = max(left, l); - tmp.top = max(top, t); - tmp.right = min(right, r); - tmp.bottom = min(bottom, b); - return tmp; - } - public: float left; float top; @@ -115,7 +104,7 @@ public: } bool intersects(float l, float t, float r, float b) const { - return !intersectWith(l,t,r,b).isEmpty(); + return !intersectWith(l, t, r, b).isEmpty(); } bool intersects(const Rect& r) const { @@ -123,7 +112,7 @@ public: } bool intersect(float l, float t, float r, float b) { - Rect tmp(intersectWith(l,t,r,b)); + Rect tmp(intersectWith(l, t, r, b)); if (!tmp.isEmpty()) { set(tmp); return true; @@ -172,6 +161,19 @@ public: LOGD("Rect[l=%f t=%f r=%f b=%f]", left, top, right, bottom); } +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; } + + Rect intersectWith(float l, float t, float r, float b) const { + Rect tmp; + tmp.left = max(left, l); + tmp.top = max(top, t); + tmp.right = min(right, r); + tmp.bottom = min(bottom, b); + return tmp; + } + }; // class Rect }; // namespace uirenderer |