summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMenTaLguY <mental@rydia.net>2007-03-04 19:06:59 +0000
committermental <mental@users.sourceforge.net>2007-03-04 19:06:59 +0000
commit4b6a319dd5cff28fcf9d075cadbfdb4cc247c937 (patch)
tree84ad3a3b5fe2cdf9dd3e3221acdefcfae6570531 /src
parentremove remaining use of assume in nr-rect.cpp (diff)
downloadinkscape-4b6a319dd5cff28fcf9d075cadbfdb4cc247c937.tar.gz
inkscape-4b6a319dd5cff28fcf9d075cadbfdb4cc247c937.zip
return plain rect for union in all situations where a plain rect is given
(bzr r2542)
Diffstat (limited to 'src')
-rw-r--r--src/libnr/nr-rect.cpp10
-rw-r--r--src/libnr/nr-rect.h25
2 files changed, 24 insertions, 11 deletions
diff --git a/src/libnr/nr-rect.cpp b/src/libnr/nr-rect.cpp
index c681783c7..76d7fff8d 100644
--- a/src/libnr/nr-rect.cpp
+++ b/src/libnr/nr-rect.cpp
@@ -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;
diff --git a/src/libnr/nr-rect.h b/src/libnr/nr-rect.h
index b6918c493..115f94e46 100644
--- a/src/libnr/nr-rect.h
+++ b/src/libnr/nr-rect.h
@@ -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 */