FloatRect: add implicit IntRect conversion

This commit is contained in:
Jonas Kulla 2013-09-03 14:51:13 +02:00
parent 73812e957e
commit 6c5745c4bf
1 changed files with 5 additions and 0 deletions

View File

@ -183,6 +183,11 @@ struct FloatRect
: x(r.x), y(r.y), w(r.w), h(r.h) : x(r.x), y(r.y), w(r.w), h(r.h)
{} {}
operator IntRect() const
{
return IntRect(x, y, w, h);
}
Vec2 topLeft() const { return Vec2(x, y); } Vec2 topLeft() const { return Vec2(x, y); }
Vec2 bottomLeft() const { return Vec2(x, y+h); } Vec2 bottomLeft() const { return Vec2(x, y+h); }
Vec2 topRight() const { return Vec2(x+w, y); } Vec2 topRight() const { return Vec2(x+w, y); }