diff options
author | Steven Bennetts <steve@lindenlab.com> | 2008-02-19 21:42:32 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2008-02-19 21:42:32 +0000 |
commit | 2e32d44e7165775936beae5d9ef636ff9d3f2bd2 (patch) | |
tree | 8153bc399994aabf6e1c41c2d8332e4e8c4ddb78 /indra/llmath/llrect.h | |
parent | db0f5847ea8b96b3c1ac08e7aeb43d83daacb8e4 (diff) |
merge svn+ssh://svn.lindenlab.com/svn/linden/qa/combo-merge-ui-2008-02-13 -r 79986 : 80178 -> release.
QAR-290 = QAR-271 + QAR-191
Diffstat (limited to 'indra/llmath/llrect.h')
-rw-r--r-- | indra/llmath/llrect.h | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/indra/llmath/llrect.h b/indra/llmath/llrect.h index e7b15dcc58..1fa5a741d5 100644 --- a/indra/llmath/llrect.h +++ b/indra/llmath/llrect.h @@ -152,68 +152,74 @@ public: mBottom <= rect->mTop && rect->mBottom <= mTop ; } - void set(Type left, Type top, Type right, Type bottom) + LLRectBase& set(Type left, Type top, Type right, Type bottom) { mLeft = left; mTop = top; mRight = right; mBottom = bottom; + return *this; } // Note: follows GL_QUAD conventions: the top and right edges are not considered part of the rect - void setOriginAndSize( Type left, Type bottom, Type width, Type height) + LLRectBase& setOriginAndSize( Type left, Type bottom, Type width, Type height) { mLeft = left; mTop = bottom + height; mRight = left + width; mBottom = bottom; + return *this; } // Note: follows GL_QUAD conventions: the top and right edges are not considered part of the rect - void setLeftTopAndSize( Type left, Type top, Type width, Type height) + LLRectBase& setLeftTopAndSize( Type left, Type top, Type width, Type height) { mLeft = left; mTop = top; mRight = left + width; mBottom = top - height; + return *this; } - void setCenterAndSize(Type x, Type y, Type width, Type height) + LLRectBase& setCenterAndSize(Type x, Type y, Type width, Type height) { mLeft = x - width/2; mTop = y + height/2; mRight = x + width/2; mBottom = y - height/2; + return *this; } - void translate(Type horiz, Type vertical) + LLRectBase& translate(Type horiz, Type vertical) { mLeft += horiz; mRight += horiz; mTop += vertical; mBottom += vertical; + return *this; } - void stretch( Type dx, Type dy) + LLRectBase& stretch( Type dx, Type dy) { mLeft -= dx; mRight += dx; mTop += dy; mBottom -= dy; - makeValid(); + return makeValid(); } - void stretch( Type delta ) + LLRectBase& stretch( Type delta ) { stretch(delta, delta); - + return *this; } - void makeValid() + LLRectBase& makeValid() { mLeft = llmin(mLeft, mRight); mBottom = llmin(mBottom, mTop); + return *this; } bool isNull() const @@ -221,15 +227,16 @@ public: return mLeft == mRight || mBottom == mTop; } - void unionWith(const LLRectBase &other) + LLRectBase& unionWith(const LLRectBase &other) { mLeft = llmin(mLeft, other.mLeft); mRight = llmax(mRight, other.mRight); mBottom = llmin(mBottom, other.mBottom); mTop = llmax(mTop, other.mTop); + return *this; } - void intersectWith(const LLRectBase &other) + LLRectBase& intersectWith(const LLRectBase &other) { mLeft = llmax(mLeft, other.mLeft); mRight = llmin(mRight, other.mRight); @@ -243,6 +250,7 @@ public: { mBottom = mTop; } + return *this; } friend std::ostream &operator<<(std::ostream &s, const LLRectBase &rect) |