summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-20 09:29:23 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-20 10:47:44 +0200
commitdf4c562ac613ce51d431cbb633ffe57c5305714f (patch)
tree35bc0691f68140e465c4db07e18e081f58e41555 /tools
parentc7821b8cd1bfd93ac232d9b3cc114e9ed9931bc9 (diff)
add tools::Rectangle::Justify
so rectangles can be constructed already valid Change-Id: I3ae5e24add3c81f79dcdf863f855dca439876f11 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92521 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools')
-rw-r--r--tools/source/generic/gen.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx
index 7c182818c460..7a275eea3088 100644
--- a/tools/source/generic/gen.cxx
+++ b/tools/source/generic/gen.cxx
@@ -37,6 +37,15 @@ OString Pair::toString() const
return ss.str().c_str();
}
+tools::Rectangle tools::Rectangle::Justify( const Point& rLT, const Point& rRB )
+{
+ long nLeft = std::min(rLT.X(), rRB.X());
+ long nTop = std::min(rLT.Y(), rRB.Y());
+ long nRight = std::max(rLT.X(), rRB.X());
+ long nBottom = std::max(rLT.Y(), rRB.Y());
+ return Rectangle( nLeft, nTop, nRight, nBottom );
+}
+
void tools::Rectangle::SetSize( const Size& rSize )
{
if ( rSize.Width() < 0 )