diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-12 12:06:41 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-12 17:04:02 +0200 |
commit | 1ce1c26dd98e6477139e08d1ebe89fa950ff5fb0 (patch) | |
tree | 462fdc3beda919e1b399d8bb168f472cf175a48f /tools/source | |
parent | b11ea5e9c37b19f0d60a4075146668954a7bf728 (diff) |
make tools::Rectangle::Right return Left when empty
I tried making this assert, but there are just too many places where we
pass around empty rectangles, so rather just return the value of nLeft,
in a similar fashion to methods like Rectangle::TopLeft
Change-Id: I3377071ecae26f13e895ae411cd269f0bdbe0ef6
Reviewed-on: https://gerrit.libreoffice.org/75486
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools/source')
-rw-r--r-- | tools/source/generic/gen.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index fc927f50e41e..459687dc961a 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.cxx @@ -20,6 +20,7 @@ #include <sal/config.h> #include <algorithm> +#include <cassert> #include <sstream> #include <o3tl/safeint.hxx> #include <tools/gen.hxx> @@ -291,4 +292,9 @@ void tools::Rectangle::setY( long y ) nTop = y; } +long tools::Rectangle::Right() const +{ + return nRight == RECT_EMPTY ? nLeft : nRight; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |