diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/libnr/nr-rect.cpp | 10 | ||||
| -rw-r--r-- | src/libnr/nr-rect.h | 25 |
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 */ |
