[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - svx/source

Regina Henschel (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 22 18:40:13 UTC 2019


 svx/source/svdraw/svdopath.cxx |   71 +++++++++++++++++++++++++----------------
 1 file changed, 44 insertions(+), 27 deletions(-)

New commits:
commit 46c7341014870b4d2c9babd91c14dfed4422f93a
Author:     Regina Henschel <rb.henschel at t-online.de>
AuthorDate: Wed Aug 21 14:11:23 2019 +0200
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Aug 22 20:39:24 2019 +0200

    tdf#126271 Revert "tdf120965 Simplify SdrPathObj::AddToHdlList()"
    
    This reverts commit 26001f4f84b0d921c8612d888856613735ba5314.
    
    Change-Id: Ib4df476b405e65be9203ab376c9c68b03198c040
    Reviewed-on: https://gerrit.libreoffice.org/77882
    Tested-by: Regina Henschel <rb.henschel at t-online.de>
    Reviewed-by: Regina Henschel <rb.henschel at t-online.de>
    (cherry picked from commit 59189f3e02acbdf4e5bbd35fc278252b30022f43)
    Reviewed-on: https://gerrit.libreoffice.org/77940
    Tested-by: Jenkins

diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index 63481a141248..eda7c34db46a 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -2008,45 +2008,62 @@ void SdrPathObj::AddToHdlList(SdrHdlList& rHdlList) const
 
 void SdrPathObj::AddToPlusHdlList(SdrHdlList& rHdlList, SdrHdl& rHdl) const
 {
-    // exclude some error situations
-    const XPolyPolygon aPathPolyPolygon(GetPathPoly());
+    // keep old stuff to be able to keep old SdrHdl stuff, too
+    const XPolyPolygon aOldPathPolygon(GetPathPoly());
+    sal_uInt16 nPnt = static_cast<sal_uInt16>(rHdl.GetPointNum());
     sal_uInt16 nPolyNum = static_cast<sal_uInt16>(rHdl.GetPolyNum());
-    if (nPolyNum>=aPathPolyPolygon.Count())
-        return;
 
-    const XPolygon& rXPoly = aPathPolyPolygon[nPolyNum];
-    sal_uInt16 nPntCount = rXPoly.GetPointCount();
-    if (nPntCount<=0)
+    if (nPolyNum>=aOldPathPolygon.Count())
         return;
 
-    sal_uInt16 nPnt = static_cast<sal_uInt16>(rHdl.GetPointNum());
-    if (nPnt>=nPntCount)
-        return;
+    const XPolygon& rXPoly = aOldPathPolygon[nPolyNum];
+    sal_uInt16 nPntMax = rXPoly.GetPointCount();
 
-    if (rXPoly.IsControl(nPnt))
+    if (nPntMax<=0)
+        return;
+    nPntMax--;
+    if (nPnt>nPntMax)
         return;
 
-    // segment before
-    if (nPnt==0 && IsClosed())
-        nPnt=nPntCount-1;
-    if (nPnt>0 && rXPoly.IsControl(nPnt-1))
+    // calculate the number of plus points
+    sal_uInt16 nCnt = 0;
+    if (rXPoly.GetFlags(nPnt)!=PolyFlags::Control)
     {
-        std::unique_ptr<SdrHdl> pHdl(new SdrHdlBezWgt(&rHdl));
-        pHdl->SetPos(rXPoly[nPnt-1]);
-        pHdl->SetPointNum(nPnt-1);
-        pHdl->SetSourceHdlNum(rHdl.GetSourceHdlNum());
-        pHdl->SetPlusHdl(true);
-        rHdlList.AddHdl(std::move(pHdl));
+        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++;
     }
 
-    // segment after
-    if (nPnt==nPntCount-1 && IsClosed())
-        nPnt=0;
-    if (nPnt<nPntCount-1 && rXPoly.IsControl(nPnt+1))
+    // 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->SetPos(rXPoly[nPnt+1]);
-        pHdl->SetPointNum(nPnt+1);
+        pHdl->SetPolyNum(rHdl.GetPolyNum());
+
+        if (nPnt==0 && IsClosed())
+            nPnt=nPntMax;
+        if (nPnt>0 && rXPoly.GetFlags(nPnt-1)==PolyFlags::Control && nPlusNum==0)
+        {
+            pHdl->SetPos(rXPoly[nPnt-1]);
+            pHdl->SetPointNum(nPnt-1);
+        }
+        else
+        {
+            if (nPnt==nPntMax && IsClosed())
+                nPnt=0;
+            if (nPnt<rXPoly.GetPointCount()-1 && rXPoly.GetFlags(nPnt+1)==PolyFlags::Control)
+            {
+                pHdl->SetPos(rXPoly[nPnt+1]);
+                pHdl->SetPointNum(nPnt+1);
+            }
+        }
+
         pHdl->SetSourceHdlNum(rHdl.GetSourceHdlNum());
         pHdl->SetPlusHdl(true);
         rHdlList.AddHdl(std::move(pHdl));


More information about the Libreoffice-commits mailing list