]> git.mxchange.org Git - simgear.git/blobdiff - simgear/math/SGRect.hxx
DrawElementsFacade: use ref_ptr instead of mismatched new/free
[simgear.git] / simgear / math / SGRect.hxx
index da5cdcfe65dcbace4949ea6a7174cd4764d8a32f..86dd482c9c8875c54bdd848abff6fe2df6656e32 100644 (file)
@@ -113,6 +113,18 @@ class SGRect
     void setTop(T t) { _min.y() = t; }
     void setBottom(T b) { _max.y() = b; }
 
+    /**
+     * Expand rectangle to include the given position
+     */
+    void expandBy(T x, T y)
+    {
+      if( x < _min.x() ) _min.x() = x;
+      if( x > _max.x() ) _max.x() = x;
+
+      if( y < _min.y() ) _min.y() = y;
+      if( y > _max.y() ) _max.y() = y;
+    }
+
     /**
      * Move rect by vector
      */