Code

return plain rect for union in all situations where a plain rect is given
authormental <mental@users.sourceforge.net>
Sun, 4 Mar 2007 19:06:59 +0000 (19:06 +0000)
committermental <mental@users.sourceforge.net>
Sun, 4 Mar 2007 19:06:59 +0000 (19:06 +0000)
src/libnr/nr-rect.cpp
src/libnr/nr-rect.h

index c681783c7b6fd63d2de830e6a4f92c5dc693cb11..76d7fff8dd8ce956bc4f6b326d698a0992821253 100644 (file)
@@ -276,16 +276,6 @@ Maybe<Rect> Rect::intersection(Maybe<Rect> const &a, Maybe<Rect> const &b) {
     }
 }
 
-Maybe<Rect> Rect::union_bounds(Maybe<Rect> const &a, Maybe<Rect> const &b) {
-    if (a) {
-        return b;
-    } else if (b) {
-        return a;
-    } else {
-        return union_bounds(*a, *b);
-    }
-}
-
 /** returns the smallest rectangle containing both rectangles */
 Rect Rect::union_bounds(Rect const &a, Rect const &b) {
     Rect r;
index b6918c4931b77e8730b3f4c33add4b79e6d8800d..115f94e46043f2bb36fd3485559c18187d6a8833 100644 (file)
@@ -184,7 +184,30 @@ public:
     static Maybe<Rect> intersection(Maybe<Rect> const &a, Maybe<Rect> const &b);
 
     /** Returns the smallest rectangle that encloses both rectangles. */
-    static Maybe<Rect> union_bounds(Maybe<Rect> const &a, Maybe<Rect> const &b);
+    static Maybe<Rect> union_bounds(Maybe<Rect> const &a, Maybe<Rect> const &b)
+    {
+        if (!a) {
+            return b;
+        } else if (!b) {
+            return a;
+        } else {
+            return union_bounds(*a, *b);
+        }
+    }
+    static Rect union_bounds(Maybe<Rect> const &a, Rect const &b) {
+        if (a) {
+            return union_bounds(*a, b);
+        } else {
+            return b;
+        }
+    }
+    static Rect union_bounds(Rect const &a, Maybe<Rect> const &b) {
+        if (b) {
+            return union_bounds(a, *b);
+        } else {
+            return a;
+        }
+    }
     static Rect union_bounds(Rect const &a, Rect const &b);
 
     /** Scales the rect by s, with origin at 0, 0 */