diff options
author | Mathias Agopian <mathias@google.com> | 2009-05-27 14:34:50 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2009-05-27 14:34:50 -0700 |
commit | 2da99bdaa1712f00525e6a84b58044332cb1baef (patch) | |
tree | ed330500de06dc645769ea87372fb624390b52a8 /include/ui | |
parent | 947f4f4d384ea26eb2145cc070a3eed42c59534a (diff) | |
parent | cc77841f643751fd9f128e90f7d1587445ef353e (diff) | |
download | frameworks_base-2da99bdaa1712f00525e6a84b58044332cb1baef.zip frameworks_base-2da99bdaa1712f00525e6a84b58044332cb1baef.tar.gz frameworks_base-2da99bdaa1712f00525e6a84b58044332cb1baef.tar.bz2 |
Merge commit 'goog/master' into merge_master
Conflicts:
include/ui/Rect.h
libs/ui/ISurfaceComposer.cpp
Diffstat (limited to 'include/ui')
-rw-r--r-- | include/ui/Point.h | 21 | ||||
-rw-r--r-- | include/ui/Rect.h | 53 |
2 files changed, 30 insertions, 44 deletions
diff --git a/include/ui/Point.h b/include/ui/Point.h index dbbad1e..1653120 100644 --- a/include/ui/Point.h +++ b/include/ui/Point.h @@ -31,12 +31,9 @@ public: // because we want the compiler generated versions // Default constructor doesn't initialize the Point - inline Point() - { + inline Point() { } - - inline Point(int _x, int _y) : x(_x), y(_y) - { + inline Point(int x, int y) : x(x), y(y) { } inline bool operator == (const Point& rhs) const { @@ -57,8 +54,8 @@ public: } inline Point& operator - () { - x=-x; - y=-y; + x = -x; + y = -y; return *this; } @@ -73,11 +70,13 @@ public: return *this; } - Point operator + (const Point& rhs) const { - return Point(x+rhs.x, y+rhs.y); + const Point operator + (const Point& rhs) const { + const Point result(x+rhs.x, y+rhs.y); + return result; } - Point operator - (const Point& rhs) const { - return Point(x-rhs.x, y-rhs.y); + const Point operator - (const Point& rhs) const { + const Point result(x-rhs.x, y-rhs.y); + return result; } }; diff --git a/include/ui/Rect.h b/include/ui/Rect.h index 902324d..da72944 100644 --- a/include/ui/Rect.h +++ b/include/ui/Rect.h @@ -30,36 +30,23 @@ public: int right; int bottom; - typedef int value_type; - // we don't provide copy-ctor and operator= on purpose // because we want the compiler generated versions - inline Rect() - { + inline Rect() { } - inline Rect(int w, int h) - : left(0), top(0), right(w), bottom(h) - { + : left(0), top(0), right(w), bottom(h) { } - inline Rect(int l, int t, int r, int b) - : left(l), top(t), right(r), bottom(b) - { + : left(l), top(t), right(r), bottom(b) { } - inline Rect(const Point& lt, const Point& rb) - : left(lt.x), top(lt.y), right(rb.x), bottom(rb.y) - { + : left(lt.x), top(lt.y), right(rb.x), bottom(rb.y) { } void makeInvalid(); - inline void clear() { - left = top = right = bottom = 0; - } - // a valid rectangle has a non negative width and height inline bool isValid() const { return (width()>=0) && (height()>=0); @@ -84,29 +71,29 @@ public: return bottom-top; } + void setLeftTop(const Point& lt) { + left = lt.x; + top = lt.y; + } + + void setRightBottom(const Point& rb) { + right = rb.x; + bottom = rb.y; + } + // the following 4 functions return the 4 corners of the rect as Point - inline Point leftTop() const { + Point leftTop() const { return Point(left, top); } - inline Point rightBottom() const { + Point rightBottom() const { return Point(right, bottom); } - inline Point rightTop() const { + Point rightTop() const { return Point(right, top); } - inline Point leftBottom() const { + Point leftBottom() const { return Point(left, bottom); } - - inline void setLeftTop(const Point& p) { - left = p.x; - top = p.y; - } - - inline void setRightBottom(const Point& p) { - right = p.x; - bottom = p.y; - } // comparisons inline bool operator == (const Rect& rhs) const { @@ -140,8 +127,8 @@ public: Rect& operator -= (const Point& rhs) { return offsetBy(-rhs.x, -rhs.y); } - Rect operator + (const Point& rhs) const; - Rect operator - (const Point& rhs) const; + const Rect operator + (const Point& rhs) const; + const Rect operator - (const Point& rhs) const; void translate(int dx, int dy) { // legacy, don't use. offsetBy(dx, dy); |