diff --git a/src/gfx/rect.cpp b/src/gfx/rect.cpp index 2eecf9487..db995685c 100644 --- a/src/gfx/rect.cpp +++ b/src/gfx/rect.cpp @@ -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 diff --git a/src/gfx/rect.h b/src/gfx/rect.h index dc4f232b9..db6726249 100644 --- a/src/gfx/rect.h +++ b/src/gfx/rect.h @@ -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;