From bfdd98d214da77b4508bc7d2e9e31817471fe90c Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 10 Jul 2019 12:38:49 +0200 Subject: make tools::Rectangle::SaturatingSetX/Y respect empty state Change-Id: Ifef4c2ff967fdfbe122bca99e55d84e8e6c6a635 Reviewed-on: https://gerrit.libreoffice.org/75343 Tested-by: Jenkins Reviewed-by: Noel Grandin --- tools/source/generic/gen.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index 1b9e4a0d733f..fc927f50e41e 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.cxx @@ -88,13 +88,15 @@ void tools::Rectangle::SaturatingSetSize(const Size& rSize) void tools::Rectangle::SaturatingSetX(long x) { - nRight = o3tl::saturating_add(nRight, x - nLeft); + if (nRight != RECT_EMPTY) + nRight = o3tl::saturating_add(nRight, x - nLeft); nLeft = x; } void tools::Rectangle::SaturatingSetY(long y) { - nBottom = o3tl::saturating_add(nBottom, y - nTop); + if (nBottom != RECT_EMPTY) + nBottom = o3tl::saturating_add(nBottom, y - nTop); nTop = y; } -- cgit