[Libreoffice-commits] core.git: svx/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Nov 7 10:25:22 UTC 2018
svx/source/svdraw/svdopath.cxx | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
New commits:
commit bdc97ababa5017422f5bcdb345969f6691fc818d
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Nov 7 10:34:51 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Nov 7 11:23:51 2018 +0100
tdf120965 Phantom control point line in Bézier curve
regression from
commit f74b888244fcefa7c03fa25db4d42c839ebbf642
simplify PlusHdl logic
restore the structure of the original code here, which is completely
opaque to me
Change-Id: I7b9e5732bd7ed0a92627503ea3c7d2d320a8a33b
Reviewed-on: https://gerrit.libreoffice.org/62989
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index 0e56b63494e6..eda7c34db46a 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -2021,14 +2021,33 @@ void SdrPathObj::AddToPlusHdlList(SdrHdlList& rHdlList, SdrHdl& rHdl) const
if (nPntMax<=0)
return;
-
nPntMax--;
- for (sal_uInt32 nPlusNum = 0; nPlusNum <= nPntMax; ++nPlusNum)
+ if (nPnt>nPntMax)
+ return;
+
+ // calculate the number of plus points
+ sal_uInt16 nCnt = 0;
+ if (rXPoly.GetFlags(nPnt)!=PolyFlags::Control)
+ {
+ if (nPnt==0 && IsClosed())
+ nPnt=nPntMax;
+ if (nPnt>0 && rXPoly.GetFlags(nPnt-1)==PolyFlags::Control)
+ nCnt++;
+ if (nPnt==nPntMax && IsClosed())
+ nPnt=0;
+ if (nPnt<nPntMax && rXPoly.GetFlags(nPnt+1)==PolyFlags::Control)
+ nCnt++;
+ }
+
+ // construct the plus points
+ for (sal_uInt32 nPlusNum = 0; nPlusNum < nCnt; ++nPlusNum)
{
+ nPnt = static_cast<sal_uInt16>(rHdl.GetPointNum());
std::unique_ptr<SdrHdl> pHdl(new SdrHdlBezWgt(&rHdl));
pHdl->SetPolyNum(rHdl.GetPolyNum());
- if (nPnt==0 && IsClosed()) nPnt=nPntMax;
+ if (nPnt==0 && IsClosed())
+ nPnt=nPntMax;
if (nPnt>0 && rXPoly.GetFlags(nPnt-1)==PolyFlags::Control && nPlusNum==0)
{
pHdl->SetPos(rXPoly[nPnt-1]);
@@ -2036,7 +2055,8 @@ void SdrPathObj::AddToPlusHdlList(SdrHdlList& rHdlList, SdrHdl& rHdl) const
}
else
{
- if (nPnt==nPntMax && IsClosed()) nPnt=0;
+ if (nPnt==nPntMax && IsClosed())
+ nPnt=0;
if (nPnt<rXPoly.GetPointCount()-1 && rXPoly.GetFlags(nPnt+1)==PolyFlags::Control)
{
pHdl->SetPos(rXPoly[nPnt+1]);
More information about the Libreoffice-commits
mailing list