diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-12 09:14:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-12 12:06:10 +0200 |
commit | 76c4ed30437125a922936c036a3dc57441938c61 (patch) | |
tree | 89730a7d100f2a2e3f0873fcecb624ccf06034be /tools | |
parent | 953db3ca96d0055a83f718794416a9e39b0b20ce (diff) |
Revert "improve empty tools::Rectangle (width)"
This reverts commit a46a257794f1f53b294735fc876c394be23a3811.
Too many issues, I'm going to try landing this in smaller pieces to make it easier to fix regressions
Change-Id: Ie5e8979838017af86c119c887b580385ba068d54
Reviewed-on: https://gerrit.libreoffice.org/73859
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/generic/gen.cxx | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index 6438405c99e2..3593801579ac 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.cxx @@ -55,20 +55,11 @@ OString Pair::toString() const void tools::Rectangle::SetSize( const Size& rSize ) { if ( rSize.Width() < 0 ) - { nRight = nLeft + rSize.Width() +1; - mbWidthEmpty = false; - } else if ( rSize.Width() > 0 ) - { nRight = nLeft + rSize.Width() -1; - mbWidthEmpty = false; - } else - { - nRight = 0; - mbWidthEmpty = true; - } + nRight = RECT_EMPTY; if ( rSize.Height() < 0 ) nBottom = nTop + rSize.Height() +1; @@ -81,20 +72,11 @@ void tools::Rectangle::SetSize( const Size& rSize ) void tools::Rectangle::SaturatingSetSize(const Size& rSize) { if (rSize.Width() < 0) - { nRight = o3tl::saturating_add(nLeft, (rSize.Width() + 1)); - mbWidthEmpty = false; - } else if ( rSize.Width() > 0 ) - { nRight = o3tl::saturating_add(nLeft, (rSize.Width() - 1)); - mbWidthEmpty = false; - } else - { - nRight = 0; - mbWidthEmpty = true; - } + nRight = RECT_EMPTY; if ( rSize.Height() < 0 ) nBottom = o3tl::saturating_add(nTop, (rSize.Height() + 1)); @@ -106,8 +88,7 @@ void tools::Rectangle::SaturatingSetSize(const Size& rSize) void tools::Rectangle::SaturatingSetX(long x) { - if (!mbWidthEmpty) - nRight = o3tl::saturating_add(nRight, x - nLeft); + nRight = o3tl::saturating_add(nRight, x - nLeft); nLeft = x; } @@ -165,7 +146,7 @@ tools::Rectangle& tools::Rectangle::Intersection( const tools::Rectangle& rRect void tools::Rectangle::Justify() { - if ( (nRight < nLeft) && !mbWidthEmpty ) + if ( (nRight < nLeft) && (nRight != RECT_EMPTY) ) { std::swap(nLeft, nRight); } @@ -225,9 +206,8 @@ SvStream& ReadRectangle( SvStream& rIStream, tools::Rectangle& rRect ) rRect.nLeft = nTmpL; rRect.nTop = nTmpT; - rRect.nRight = nTmpR == Rectangle::RECT_EMPTY ? 0 : nTmpR; + rRect.nRight = nTmpR; rRect.nBottom = nTmpB; - rRect.mbWidthEmpty = nTmpR == Rectangle::RECT_EMPTY; return rIStream; } @@ -236,7 +216,7 @@ SvStream& WriteRectangle( SvStream& rOStream, const tools::Rectangle& rRect ) { rOStream.WriteInt32( rRect.nLeft ) .WriteInt32( rRect.nTop ) - .WriteInt32( rRect.mbWidthEmpty ? Rectangle::RECT_EMPTY : rRect.nRight ) + .WriteInt32( rRect.nRight ) .WriteInt32( rRect.nBottom ); return rOStream; |