]> git.mxchange.org Git - flightgear.git/blobdiff - src/Canvas/rect.hxx
Fix a Clang warning in Shiva.
[flightgear.git] / src / Canvas / rect.hxx
index b3b42cc4e33d7e956b4a6733882834a0b045a0ec..76c5ecf01418702c16373b104a0999d2f4ea24d1 100644 (file)
@@ -27,7 +27,12 @@ namespace canvas
   class Rect
   {
     public:
-      Rect() {}
+      Rect():
+        _x1(0),
+        _x2(0),
+        _y1(0),
+        _y2(0)
+      {}
 
       Rect(T x, T y, T w, T h):
         _x1(x),
@@ -49,11 +54,21 @@ namespace canvas
       T width() const { return _x2 - _x1; }
       T height() const { return _y2 - _y1; }
 
+      void setX(T x) { T w = width(); _x1 = x; _x2 = x + w; }
+      void setY(T y) { T h = height(); _y1 = y; _y2 = y + h; }
+      void setWidth(T w) { _x2 = _x1 + w; }
+      void setHeight(T h) { _y2 = _y1 + h; }
+
       T l() const { return _x1; }
       T r() const { return _x2; }
       T t() const { return _y1; }
       T b() const { return _y2; }
 
+      void setLeft(T l) { _x1 = l; }
+      void setRight(T r) { _x2 = r; }
+      void setTop(T t) { _y1 = t; }
+      void setBottom(T b) { _y2 = b; }
+
       bool contains(T x, T y) const
       {
         return _x1 <= x && x <= _x2