aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorEugene Sandulenko2013-07-29 12:25:57 +0300
committerEugene Sandulenko2013-07-29 12:25:57 +0300
commit351af76f9bce9b78ef10cb403c635e7b121e883b (patch)
treee4f6a59071f14941166f71c2b23eb48b308bfdcf /common
parent9d89861f77c9f7fc17ea93f90e7b8e937ec94298 (diff)
downloadscummvm-rg350-351af76f9bce9b78ef10cb403c635e7b121e883b.tar.gz
scummvm-rg350-351af76f9bce9b78ef10cb403c635e7b121e883b.tar.bz2
scummvm-rg350-351af76f9bce9b78ef10cb403c635e7b121e883b.zip
COMMON: Added copy constructors and copier to Rect and Point.
Diffstat (limited to 'common')
-rw-r--r--common/rect.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/common/rect.h b/common/rect.h
index 5790cf7c0f..31e0b5152f 100644
--- a/common/rect.h
+++ b/common/rect.h
@@ -38,11 +38,14 @@ struct Point {
Point() : x(0), y(0) {}
Point(int16 x1, int16 y1) : x(x1), y(y1) {}
+ Point(const Point &p) : x(p.x), y(p.y) {}
bool operator==(const Point &p) const { return x == p.x && y == p.y; }
bool operator!=(const Point &p) const { return x != p.x || y != p.y; }
Point operator+(const Point &delta) const { return Point(x + delta.x, y + delta.y); }
Point operator-(const Point &delta) const { return Point(x - delta.x, y - delta.y); }
+ void copy(const Point &p) { x = p.x; y = p.y; }
+
void operator+=(const Point &delta) {
x += delta.x;
y += delta.y;
@@ -99,9 +102,12 @@ struct Rect {
Rect(int16 x1, int16 y1, int16 x2, int16 y2) : top(y1), left(x1), bottom(y2), right(x2) {
assert(isValidRect());
}
+ Rect(const Rect &r) : top(r.top), left(r.left), bottom(r.bottom), right(r.right) {}
bool operator==(const Rect &rhs) const { return equals(rhs); }
bool operator!=(const Rect &rhs) const { return !equals(rhs); }
+ void copy(const Rect &r) { top = r.top; left = r.left; bottom = r.bottom; right = r.right; }
+
int16 width() const { return right - left; }
int16 height() const { return bottom - top; }