Rename Rect::inflate() -> enlarge() and Rect::deflate -> shrink().

This commit is contained in:
David Capello 2011-01-30 20:03:10 -03:00
parent 2baa342a65
commit 7273b95b68
2 changed files with 16 additions and 16 deletions

View File

@ -155,7 +155,7 @@ Rect& Rect::inflate(const Size& delta)
return *this;
}
Rect& Rect::inflate(const Border& br)
Rect& Rect::enlarge(const Border& br)
{
x -= br.left();
y -= br.top();
@ -164,15 +164,6 @@ Rect& Rect::inflate(const Border& br)
return *this;
}
Rect& Rect::deflate(const Border& br)
{
x += br.left();
y += br.top();
w -= br.left() + br.right();
h -= br.top() + br.bottom();
return *this;
}
Rect& Rect::enlarge(int unit)
{
x -= unit;
@ -182,6 +173,15 @@ Rect& Rect::enlarge(int unit)
return *this;
}
Rect& Rect::shrink(const Border& br)
{
x += br.left();
y += br.top();
w -= br.left() + br.right();
h -= br.top() + br.bottom();
return *this;
}
Rect& Rect::shrink(int unit)
{
x += unit;
@ -244,24 +244,24 @@ Rect Rect::createIntersect(const Rect& rc) const
const Rect& Rect::operator+=(const Border& br)
{
inflate(br);
enlarge(br);
return *this;
}
const Rect& Rect::operator-=(const Border& br)
{
deflate(br);
shrink(br);
return *this;
}
Rect Rect::operator+(const Border& br) const
{
return Rect(*this).inflate(br);
return Rect(*this).enlarge(br);
}
Rect Rect::operator-(const Border& br) const
{
return Rect(*this).deflate(br);
return Rect(*this).shrink(br);
}
bool Rect::operator==(const Rect& rc) const

View File

@ -78,11 +78,11 @@ public:
Rect& offset(const Point& delta);
Rect& inflate(int dw, int dh);
Rect& inflate(const Size& delta);
Rect& inflate(const Border& br);
Rect& deflate(const Border& br);
Rect& enlarge(int unit);
Rect& enlarge(const Border& br);
Rect& shrink(int unit);
Rect& shrink(const Border& br);
// Returns true if this rectangle encloses the pt point.
bool contains(const Point& pt) const;