made rects signed

svn-id: r45891
This commit is contained in:
Vladimir Menshakov
2009-11-14 11:32:39 +00:00
parent a6f954c365
commit 772ac8ca70
+6 -2
View File
@@ -32,7 +32,7 @@
namespace TeenAgent {
struct Rect {
uint16 left, top, right, bottom;
int16 left, top, right, bottom;
inline Rect() : left(0), top(0), right(0), bottom(0), _base(NULL) {}
@@ -47,7 +47,7 @@ struct Rect {
}
inline bool valid() const {
return left < 320 && right < 320 && top < 200 && bottom < 200;
return left >= 0 && left < 320 && right >= 0 && right < 320 && top >= 0 && top < 200 && bottom >= 0 && bottom < 200;
}
void render(Graphics::Surface *surface, uint8 color) const;
@@ -74,6 +74,10 @@ struct Rect {
SWAP(y1, y2);
return x >= left && x <= right && y1 <= bottom && y2 >= top;
}
inline bool contains(const Rect & rect) const {
return rect.left >= left && rect.right <= right && rect.top >= top && rect.bottom <= bottom;
}
protected:
byte * _base;