mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-22 04:01:23 +00:00
added Rect::moveTo methods
svn-id: r13190
This commit is contained in:
parent
601723408f
commit
af2f29f55c
@ -78,7 +78,7 @@ struct Rect {
|
|||||||
@return true if the given point is inside this rectangle, false otherwise
|
@return true if the given point is inside this rectangle, false otherwise
|
||||||
*/
|
*/
|
||||||
bool contains(const Point & p) const {
|
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
|
/*! @brief check if given rectangle intersects with this rectangle
|
||||||
@ -137,6 +137,17 @@ struct Rect {
|
|||||||
bool isValidRect() const {
|
bool isValidRect() const {
|
||||||
return (left <= right && top <= bottom);
|
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
|
} // End of namespace Common
|
||||||
|
Loading…
x
Reference in New Issue
Block a user