summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2021-05-18 17:36:21 +0200
committerAndras Timar <andras.timar@collabora.com>2021-05-21 13:31:51 +0200
commit3c1121fad94e82b2d4e047dd2a3a80d996240fa0 (patch)
tree95a0c52ae53981fb84ffc28bd352549cb7639883 /tools
parent5e046f9c74977b0db7502fa73e7488c64027a957 (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> (cherry picked from commit 39369c6e67dffe04acc4abb678c1a94526237fd8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115524 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'tools')
-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 f4631dfb1d86..8b4727782350 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 tools::Long nWidth = rBound.GetWidth();
const tools::Long nHeight = rBound.GetHeight();
- if( ( nWidth > 1 ) && ( nHeight > 1 ) )
+ if( ( nWidth != 0 ) && ( nHeight != 0 ) )
{
const Point aCenter( rBound.Center() );
- const tools::Long nRadX = aCenter.X() - rBound.Left();
- const tools::Long nRadY = 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 tools::Long nRadX = aCenter.X() - aBoundLeft;
+ const tools::Long nRadY = aCenter.Y() - aBoundTop;
sal_uInt16 nPoints;
tools::Long nRadXY;