diff options
| author | MenTaLguY <mental@rydia.net> | 2007-03-04 19:06:59 +0000 |
|---|---|---|
| committer | mental <mental@users.sourceforge.net> | 2007-03-04 19:06:59 +0000 |
| commit | 4b6a319dd5cff28fcf9d075cadbfdb4cc247c937 (patch) | |
| tree | 84ad3a3b5fe2cdf9dd3e3221acdefcfae6570531 /src/libnr/nr-rect.h | |
| parent | remove remaining use of assume in nr-rect.cpp (diff) | |
| download | inkscape-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/libnr/nr-rect.h')
| -rw-r--r-- | src/libnr/nr-rect.h | 25 |
1 files changed, 24 insertions, 1 deletions
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 */ |
