aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/rect.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/common/rect.h b/common/rect.h
index 2f28aae097..c9a6a572fd 100644
--- a/common/rect.h
+++ b/common/rect.h
@@ -78,7 +78,7 @@ struct Rect {
@return true if the given point is inside this rectangle, false otherwise
*/
bool contains(const Point & p) const {
- return (left <= p.x) && (p.x < right) && (top <= p.y) && (p.y < bottom);
+ return contains(p.x, p.y);
}
/*! @brief check if given rectangle intersects with this rectangle
@@ -137,6 +137,17 @@ struct Rect {
bool isValidRect() const {
return (left <= right && top <= bottom);
}
+
+ void moveTo(int16 x, int16 y) {
+ bottom += y - top;
+ right += x - left;
+ top = y;
+ left = x;
+ }
+
+ void moveTo(const Point & p) {
+ moveTo(p.x, p.y);
+ }
};
} // End of namespace Common