summaryrefslogtreecommitdiff
path: root/tools/source
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2021-05-18 17:36:21 +0200
committerBartosz Kosiorek <gang65@poczta.onet.pl>2021-05-18 20:42:27 +0200
commit39369c6e67dffe04acc4abb678c1a94526237fd8 (patch)
tree17b340b353e13bb5e9bc3385ae7ea2cb62345c53 /tools/source
parent8cf56338a96c77f4712130cc775d57410bd9b623 (diff)
tdf#55007 tdf#142263 tdf#142268 EMF Properly display ARC and CHORD
With previous implementation the ARC, ARCTO and CHORD were not displayed if the corners of rectangle was switched. With this patch the shapes are always displayed correctly. Change-Id: Ie8ac7af812298c0b96c3b5af417117784f128ce1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115757 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'tools/source')
-rw-r--r--tools/source/generic/poly.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 292247478aac..88a534660894 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -230,11 +230,14 @@ ImplPolygon::ImplPolygon( const tools::Rectangle& rBound, const Point& rStart, c
const auto nWidth = rBound.GetWidth();
const auto nHeight = rBound.GetHeight();
- if( ( nWidth > 1 ) && ( nHeight > 1 ) )
+ if( ( nWidth != 0 ) && ( nHeight != 0 ) )
{
const Point aCenter( rBound.Center() );
- const auto nRadX = o3tl::saturating_sub(aCenter.X(), rBound.Left());
- const auto nRadY = o3tl::saturating_sub(aCenter.Y(), rBound.Top());
+ // tdf#142268 Get Top Left corner of rectangle (the rectangle is not always correctly created)
+ const auto aBoundLeft = rBound.Left() < aCenter.X() ? rBound.Left() : rBound.Right();
+ const auto aBoundTop = rBound.Top() < aCenter.Y() ? rBound.Top() : rBound.Bottom();
+ const auto nRadX = o3tl::saturating_sub(aCenter.X(), aBoundLeft);
+ const auto nRadY = o3tl::saturating_sub(aCenter.Y(), aBoundTop);
sal_uInt16 nPoints;
tools::Long nRadXY;