From 9e8c6c81f2f5d3df850353ee92a5b6e52546d6c6 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 8 Jul 2019 16:40:05 +0200 Subject: make tools::Rectangle::expandBy respect empty state and make non-inline so it is easy to disable this for debugging, if need be Change-Id: Ib383bb990ddcd835ff37e98893e44156287e0488 Reviewed-on: https://gerrit.libreoffice.org/75227 Tested-by: Jenkins Reviewed-by: Noel Grandin --- tools/source/generic/gen.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tools') diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index 3593801579ac..53bb2680c5c8 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.cxx @@ -233,4 +233,19 @@ OString tools::Rectangle::toString() const return ss.str().c_str(); } +void tools::Rectangle::expand(long nExpandBy) +{ + nLeft -= nExpandBy; + nTop -= nExpandBy; + if (nRight == RECT_EMPTY) + nRight = nLeft + nExpandBy - 1; + else + nRight += nExpandBy; + if (nBottom == RECT_EMPTY) + nBottom = nTop + nExpandBy - 1; + else + nBottom += nExpandBy; +} + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3