--- a/src/misc/rect.hpp Mon Feb 19 20:04:27 2007 +0000
+++ b/src/misc/rect.hpp Mon Feb 19 20:37:33 2007 +0000
@@ -15,63 +15,64 @@
/** Template based point */
template <typename T> struct PointT : public PointRawT<T> {
+ typedef PointRawT<T> PointRaw;
PointT(T x_a = 0, T y_a = 0)
{
- x = x_a;
- y = y_a;
+ PointRaw::x = x_a;
+ PointRaw::y = y_a;
}
template <typename Ta> PointT(const PointRawT<Ta> &src)
{
- x = (T)src.x;
- y = (T)src.y;
+ PointRaw::x = (T)src.x;
+ PointRaw::y = (T)src.y;
}
- PointT& operator =(const PointRawT &src)
+ PointT& operator =(const PointRaw &src)
{
- x = (T)src.x;
- y = (T)src.y;
+ PointRaw::x = (T)src.x;
+ PointRaw::y = (T)src.y;
return *this;
}
PointT operator -() const
{
- return PointT(-x, -y);
+ return PointT(-PointRaw::x, -PointRaw::y);
}
void DoMove(T dx, T dy)
{
- x += dx;
- y += dy;
+ PointRaw::x += dx;
+ PointRaw::y += dy;
}
- void DoMove(const PointRawT &offset)
+ void DoMove(const PointRaw &offset)
{
DoMove((T)offset.x, (T)offset.y);
}
- PointT operator +(const PointRawT &offset) const
+ PointT operator +(const PointRaw &offset) const
{
PointT pt(*this);
pt.DoMove(offset);
return pt;
}
- PointT operator -(const PointRawT &offset) const
+ PointT operator -(const PointRaw &offset) const
{
PointT pt(*this);
pt.DoMove(-offset);
return pt;
}
- PointT& operator +=(const PointRawT &offset)
+ PointT& operator +=(const PointRaw &offset)
{
DoMove(offset);
return *this;
}
- PointT& operator -=(const PointRawT &offset)
+ PointT& operator -=(const PointRaw &offset)
{
DoMove(-offset);
return *this;
@@ -83,6 +84,8 @@
/** Template based rectangle */
template <typename T> struct RectT
{
+ typedef PointRawT<T> PointRaw;
+
PointT<T> top_left, bottom_right;
RectT(T left = 0, T top = 0, T right = 0, T bottom = 0)
@@ -163,17 +166,17 @@
bottom_right.y = top_left.y + val - 1;
}
- void SetTopLeft(const PointRawT<T> &pt)
+ void SetTopLeft(const PointRaw &pt)
{
top_left = pt;
}
- void SetBottomRight(const PointRawT<T> &pt)
+ void SetBottomRight(const PointRaw &pt)
{
bottom_right = pt;
}
- bool PtInRect(const PointRawT<T> &pt) const
+ bool PtInRect(const PointRaw &pt) const
{
return (top_left.x <= pt.x && pt.x <= bottom_right.x && top_left.y <= pt.y && pt.y <= bottom_right.y);
}
@@ -190,33 +193,33 @@
DoMove(PointT<T>(dx, dy));
}
- void DoMove(const PointRawT<T> &offset)
+ void DoMove(const PointRaw &offset)
{
top_left.DoMove(offset);
bottom_right.DoMove(offset);
}
- RectT operator +(const PointRawT<T> &offset) const
+ RectT operator +(const PointRaw &offset) const
{
RectT r(*this);
r.DoMove(offset);
return r;
}
- RectT operator -(const PointRawT<T> &offset) const
+ RectT operator -(const PointRaw &offset) const
{
RectT r(*this);
r.DoMove(-offset);
return r;
}
- RectT& operator +=(const PointRawT<T> &offset)
+ RectT& operator +=(const PointRaw &offset)
{
DoMove(offset);
return *this;
}
- RectT& operator -=(const PointRawT<T> &offset)
+ RectT& operator -=(const PointRaw &offset)
{
DoMove(-offset);
return *this;