Fix warning.
[dcpomatic.git] / src / lib / rect.h
index 602acfc4b8bb5cd6fb691c21861e5a19a54a2248..4851ad007fe11c6ce7b7469c2cb6f7367dd2eccd 100644 (file)
@@ -1,19 +1,20 @@
 /*
     Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
 
-    This program is free software; you can redistribute it and/or modify
+    This file is part of DCP-o-matic.
+
+    DCP-o-matic is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    This program is distributed in the hope that it will be useful,
+    DCP-o-matic is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
 
 */
 
@@ -90,10 +91,12 @@ public:
 
        void extend (Rect<T> const & other)
        {
+               T old_x = x;
+               T old_y = y;
                x = std::min (x, other.x);
                y = std::min (y, other.y);
-               width = std::max (x + width, other.x + other.width) - x;
-               height = std::max (y + height, other.y + other.height) - y;
+               width = std::max (old_x + width, other.x + other.width) - x;
+               height = std::max (old_y + height, other.y + other.height) - y;
        }
 
        Rect<T> extended (T amount) const {