[Libreoffice-commits] core.git: basegfx/source drawinglayer/source include/basegfx

Noel Grandin noel.grandin at collabora.co.uk
Wed Nov 1 06:13:52 UTC 2017


 basegfx/source/curve/b2dcubicbezier.cxx                |    9 +-
 basegfx/source/inc/stringconversiontools.hxx           |   10 +--
 basegfx/source/polygon/b2dpolypolygontools.cxx         |   21 ++----
 basegfx/source/polygon/b3dpolygontools.cxx             |   56 ++---------------
 basegfx/source/polygon/b3dpolypolygontools.cxx         |   14 +---
 basegfx/source/tools/stringconversiontools.cxx         |    2 
 drawinglayer/source/primitive3d/polygonprimitive3d.cxx |    2 
 include/basegfx/polygon/b2dpolypolygontools.hxx        |    7 --
 include/basegfx/polygon/b3dpolygontools.hxx            |    3 
 include/basegfx/polygon/b3dpolypolygontools.hxx        |    9 +-
 10 files changed, 36 insertions(+), 97 deletions(-)

New commits:
commit 094542511fae905106a9daa19c049ff669e61bdc
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Oct 31 15:43:39 2017 +0200

    loplugin:constantparam in basegfx
    
    Change-Id: Ieabdd6f8d76cfc2ed75f2ec618def6591a9adc93
    Reviewed-on: https://gerrit.libreoffice.org/44130
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx
index 446d976b1c02..3f4a100ae2e1 100644
--- a/basegfx/source/curve/b2dcubicbezier.cxx
+++ b/basegfx/source/curve/b2dcubicbezier.cxx
@@ -113,8 +113,7 @@ namespace basegfx
             const B2DPoint& rfEB,           // edge on B
             const B2DPoint& rfPB,           // end point
             B2DPolygon& rTarget,            // target polygon
-            const double& rfAngleBound,     // angle bound in [0.0 .. 2PI]
-            bool bAllowUnsharpen)           // #i37443# allow the criteria to get unsharp in recursions
+            const double& rfAngleBound)     // angle bound in [0.0 .. 2PI]
         {
             sal_uInt16 nMaxRecursionDepth(8);
             const B2DVector aLeft(rfEA - rfPA);
@@ -231,7 +230,7 @@ namespace basegfx
                     }
                     else
                     {
-                        ImpSubDivAngle(rfPA, aS1L, aS2L, aS3C, rTarget, rfAngleBound, bAllowUnsharpen, nMaxRecursionDepth);
+                        ImpSubDivAngle(rfPA, aS1L, aS2L, aS3C, rTarget, rfAngleBound, true/*bAllowUnsharpen*/, nMaxRecursionDepth);
                     }
 
                     // right
@@ -241,7 +240,7 @@ namespace basegfx
                     }
                     else
                     {
-                        ImpSubDivAngle(aS3C, aS2R, aS1R, rfPB, rTarget, rfAngleBound, bAllowUnsharpen, nMaxRecursionDepth);
+                        ImpSubDivAngle(aS3C, aS2R, aS1R, rfPB, rTarget, rfAngleBound, true/*bAllowUnsharpen*/, nMaxRecursionDepth);
                     }
                 }
             }
@@ -551,7 +550,7 @@ namespace basegfx
         if(isBezier())
         {
             // use support method #i37443# and allow unsharpen the criteria
-            ImpSubDivAngleStart(maStartPoint, maControlPointA, maControlPointB, maEndPoint, rTarget, fAngleBound * F_PI180, true/*bAllowUnsharpen*/);
+            ImpSubDivAngleStart(maStartPoint, maControlPointA, maControlPointB, maEndPoint, rTarget, fAngleBound * F_PI180);
         }
         else
         {
diff --git a/basegfx/source/inc/stringconversiontools.hxx b/basegfx/source/inc/stringconversiontools.hxx
index b49804849855..f2ccb1ac3324 100644
--- a/basegfx/source/inc/stringconversiontools.hxx
+++ b/basegfx/source/inc/stringconversiontools.hxx
@@ -36,22 +36,20 @@ namespace basegfx
                                  const sal_Int32 nLen);
 
         inline bool isOnNumberChar(const sal_Unicode aChar,
-                                   bool              bSignAllowed,
-                                   bool              bDotAllowed)
+                                   bool              bSignAllowed)
         {
             const bool bPredicate( (u'0' <= aChar && u'9' >= aChar)
                                     || (bSignAllowed && u'+' == aChar)
                                     || (bSignAllowed && u'-' == aChar)
-                                    || (bDotAllowed && u'.' == aChar));
+                                    || (u'.' == aChar));
 
             return bPredicate;
         }
 
         inline bool isOnNumberChar(const OUString& rStr,
-                                   const sal_Int32 nPos,
-                                   bool            bSignAllowed = true)
+                                   const sal_Int32 nPos)
         {
-            return isOnNumberChar(rStr[nPos], bSignAllowed, true);
+            return isOnNumberChar(rStr[nPos], true/*bSignAllowed*/);
         }
 
         bool getDoubleChar(double&          o_fRetval,
diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx
index 6e0a62f18a89..644e08bb6358 100644
--- a/basegfx/source/polygon/b2dpolypolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolypolygontools.cxx
@@ -231,7 +231,7 @@ namespace basegfx
             return fabs(getSignedArea(rCandidate));
         }
 
-        void applyLineDashing(const B2DPolyPolygon& rCandidate, const std::vector<double>& rDotDashArray, B2DPolyPolygon* pLineTarget, B2DPolyPolygon* pGapTarget, double fFullDashDotLen)
+        void applyLineDashing(const B2DPolyPolygon& rCandidate, const std::vector<double>& rDotDashArray, B2DPolyPolygon* pLineTarget, double fFullDashDotLen)
         {
             if(fFullDashDotLen == 0.0 && rDotDashArray.size())
             {
@@ -241,7 +241,7 @@ namespace basegfx
 
             if(rCandidate.count() && fFullDashDotLen > 0.0)
             {
-                B2DPolyPolygon aLineTarget, aGapTarget;
+                B2DPolyPolygon aLineTarget;
 
                 for(sal_uInt32 a(0); a < rCandidate.count(); a++)
                 {
@@ -251,18 +251,13 @@ namespace basegfx
                         aCandidate,
                         rDotDashArray,
                         pLineTarget ? &aLineTarget : nullptr,
-                        pGapTarget ? &aGapTarget : nullptr,
+                        nullptr,
                         fFullDashDotLen);
 
                     if(pLineTarget)
                     {
                         pLineTarget->append(aLineTarget);
                     }
-
-                    if(pGapTarget)
-                    {
-                        pGapTarget->append(aGapTarget);
-                    }
                 }
             }
         }
@@ -596,8 +591,7 @@ namespace basegfx
         // converters for css::drawing::PointSequence
 
         B2DPolyPolygon UnoPointSequenceSequenceToB2DPolyPolygon(
-            const css::drawing::PointSequenceSequence& rPointSequenceSequenceSource,
-            bool bCheckClosed)
+            const css::drawing::PointSequenceSequence& rPointSequenceSequenceSource)
         {
             B2DPolyPolygon aRetval;
             const css::drawing::PointSequence* pPointSequence = rPointSequenceSequenceSource.getConstArray();
@@ -605,7 +599,7 @@ namespace basegfx
 
             for(;pPointSequence != pPointSeqEnd; pPointSequence++)
             {
-                const B2DPolygon aNewPolygon = UnoPointSequenceToB2DPolygon(*pPointSequence, bCheckClosed);
+                const B2DPolygon aNewPolygon = UnoPointSequenceToB2DPolygon(*pPointSequence, true/*bCheckClosed*/);
                 aRetval.append(aNewPolygon);
             }
 
@@ -640,8 +634,7 @@ namespace basegfx
         // converters for css::drawing::PolyPolygonBezierCoords (curved polygons)
 
         B2DPolyPolygon UnoPolyPolygonBezierCoordsToB2DPolyPolygon(
-            const css::drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoordsSource,
-            bool bCheckClosed)
+            const css::drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoordsSource)
         {
             B2DPolyPolygon aRetval;
             const sal_uInt32 nSequenceCount((sal_uInt32)rPolyPolygonBezierCoordsSource.Coordinates.getLength());
@@ -658,7 +651,7 @@ namespace basegfx
                     const B2DPolygon aNewPolygon(UnoPolygonBezierCoordsToB2DPolygon(
                         *pPointSequence,
                         *pFlagSequence,
-                        bCheckClosed));
+                        true/*bCheckClosed*/));
 
                     pPointSequence++;
                     pFlagSequence++;
diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx
index de362287f8ea..17dd77600f96 100644
--- a/basegfx/source/polygon/b3dpolygontools.cxx
+++ b/basegfx/source/polygon/b3dpolygontools.cxx
@@ -94,7 +94,7 @@ namespace basegfx
             return fRetval;
         }
 
-        void applyLineDashing(const B3DPolygon& rCandidate, const std::vector<double>& rDotDashArray, B3DPolyPolygon* pLineTarget, B3DPolyPolygon* pGapTarget, double fDotDashLength)
+        void applyLineDashing(const B3DPolygon& rCandidate, const std::vector<double>& rDotDashArray, B3DPolyPolygon* pLineTarget, double fDotDashLength)
         {
             const sal_uInt32 nPointCount(rCandidate.count());
             const sal_uInt32 nDotDashCount(rDotDashArray.size());
@@ -104,7 +104,7 @@ namespace basegfx
                 fDotDashLength = std::accumulate(rDotDashArray.begin(), rDotDashArray.end(), 0.0);
             }
 
-            if(fTools::more(fDotDashLength, 0.0) && (pLineTarget || pGapTarget) && nPointCount)
+            if(fTools::more(fDotDashLength, 0.0) && pLineTarget && nPointCount)
             {
                 // clear targets
                 if(pLineTarget)
@@ -112,11 +112,6 @@ namespace basegfx
                     pLineTarget->clear();
                 }
 
-                if(pGapTarget)
-                {
-                    pGapTarget->clear();
-                }
-
                 // prepare current edge's start
                 B3DPoint aCurrentPoint(rCandidate.getB3DPoint(0));
                 const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nPointCount : nPointCount - 1);
@@ -142,9 +137,8 @@ namespace basegfx
                         {
                             // new split is inside edge, create and append snippet [fLastDotDashMovingLength, fDotDashMovingLength]
                             const bool bHandleLine(bIsLine && pLineTarget);
-                            const bool bHandleGap(!bIsLine && pGapTarget);
 
-                            if(bHandleLine || bHandleGap)
+                            if(bHandleLine)
                             {
                                 if(!aSnippet.count())
                                 {
@@ -157,10 +151,6 @@ namespace basegfx
                                 {
                                     pLineTarget->append(aSnippet);
                                 }
-                                else
-                                {
-                                    pGapTarget->append(aSnippet);
-                                }
 
                                 aSnippet.clear();
                             }
@@ -173,9 +163,8 @@ namespace basegfx
 
                         // append snippet [fLastDotDashMovingLength, fEdgeLength]
                         const bool bHandleLine(bIsLine && pLineTarget);
-                        const bool bHandleGap(!bIsLine && pGapTarget);
 
-                        if(bHandleLine || bHandleGap)
+                        if(bHandleLine)
                         {
                             if(!aSnippet.count())
                             {
@@ -200,10 +189,6 @@ namespace basegfx
                     {
                         pLineTarget->append(aSnippet);
                     }
-                    else if(!bIsLine && pGapTarget)
-                    {
-                        pGapTarget->append(aSnippet);
-                    }
                 }
 
                 // check if start and end polygon may be merged
@@ -228,28 +213,6 @@ namespace basegfx
                         }
                     }
                 }
-
-                if(pGapTarget)
-                {
-                    const sal_uInt32 nCount(pGapTarget->count());
-
-                    if(nCount > 1)
-                    {
-                        // these polygons were created above, there exists none with less than two points,
-                        // thus dircet point access below is allowed
-                        const B3DPolygon aFirst(pGapTarget->getB3DPolygon(0));
-                        B3DPolygon aLast(pGapTarget->getB3DPolygon(nCount - 1));
-
-                        if(aFirst.getB3DPoint(0).equal(aLast.getB3DPoint(aLast.count() - 1)))
-                        {
-                            // start of first and end of last are the same -> merge them
-                            aLast.append(aFirst);
-                            aLast.removeDoublePoints();
-                            pGapTarget->setB3DPolygon(0, aLast);
-                            pGapTarget->remove(nCount - 1);
-                        }
-                    }
-                }
             }
             else
             {
@@ -258,11 +221,6 @@ namespace basegfx
                 {
                     pLineTarget->append(rCandidate);
                 }
-
-                if(pGapTarget)
-                {
-                    pGapTarget->append(rCandidate);
-                }
             }
         }
 
@@ -676,7 +634,7 @@ namespace basegfx
             }
         }
 
-        bool isPointOnPolygon(const B3DPolygon& rCandidate, const B3DPoint& rPoint, bool bWithPoints)
+        bool isPointOnPolygon(const B3DPolygon& rCandidate, const B3DPoint& rPoint)
         {
             const sal_uInt32 nPointCount(rCandidate.count());
 
@@ -689,7 +647,7 @@ namespace basegfx
                 {
                     const B3DPoint aNextPoint(rCandidate.getB3DPoint((a + 1) % nPointCount));
 
-                    if(isPointOnLine(aCurrentPoint, aNextPoint, rPoint, bWithPoints))
+                    if(isPointOnLine(aCurrentPoint, aNextPoint, rPoint, true/*bWithPoints*/))
                     {
                         return true;
                     }
@@ -697,7 +655,7 @@ namespace basegfx
                     aCurrentPoint = aNextPoint;
                 }
             }
-            else if(nPointCount && bWithPoints)
+            else if(nPointCount)
             {
                 return rPoint.equal(rCandidate.getB3DPoint(0));
             }
diff --git a/basegfx/source/polygon/b3dpolypolygontools.cxx b/basegfx/source/polygon/b3dpolypolygontools.cxx
index ba93d1926b84..d3ae28120e29 100644
--- a/basegfx/source/polygon/b3dpolypolygontools.cxx
+++ b/basegfx/source/polygon/b3dpolypolygontools.cxx
@@ -455,13 +455,13 @@ namespace basegfx
             return aRetval;
         }
 
-        bool isInside(const B3DPolyPolygon& rCandidate, const B3DPoint& rPoint, bool bWithBorder)
+        bool isInside(const B3DPolyPolygon& rCandidate, const B3DPoint& rPoint)
         {
             const sal_uInt32 nPolygonCount(rCandidate.count());
 
             if(nPolygonCount == 1)
             {
-                return isInside(rCandidate.getB3DPolygon(0), rPoint, bWithBorder);
+                return isInside(rCandidate.getB3DPolygon(0), rPoint, false/*bWithBorder*/);
             }
             else
             {
@@ -470,7 +470,7 @@ namespace basegfx
                 for(sal_uInt32 a(0); a < nPolygonCount; a++)
                 {
                     const B3DPolygon aPolygon(rCandidate.getB3DPolygon(a));
-                    const bool bInside(isInside(aPolygon, rPoint, bWithBorder));
+                    const bool bInside(isInside(aPolygon, rPoint, false/*bWithBorder*/));
 
                     if(bInside)
                     {
@@ -484,8 +484,7 @@ namespace basegfx
 
 /// converters for css::drawing::PolyPolygonShape3D
         B3DPolyPolygon UnoPolyPolygonShape3DToB3DPolyPolygon(
-            const css::drawing::PolyPolygonShape3D& rPolyPolygonShape3DSource,
-            bool bCheckClosed)
+            const css::drawing::PolyPolygonShape3D& rPolyPolygonShape3DSource)
         {
             B3DPolyPolygon aRetval;
             const sal_Int32 nOuterSequenceCount(rPolyPolygonShape3DSource.SequenceX.getLength());
@@ -523,10 +522,7 @@ namespace basegfx
 
                     // #i101520# correction is needed for imported polygons of old format,
                     // see callers
-                    if(bCheckClosed)
-                    {
-                        basegfx::utils::checkClosed(aNewPolygon);
-                    }
+                    basegfx::utils::checkClosed(aNewPolygon);
 
                     aRetval.append(aNewPolygon);
                 }
diff --git a/basegfx/source/tools/stringconversiontools.cxx b/basegfx/source/tools/stringconversiontools.cxx
index 569d7d0c50f2..c657d4687bcf 100644
--- a/basegfx/source/tools/stringconversiontools.cxx
+++ b/basegfx/source/tools/stringconversiontools.cxx
@@ -170,7 +170,7 @@ namespace basegfx
             const sal_Int32 aLen( rStr.getLength() );
             if(aLen)
             {
-                if( isOnNumberChar(rStr[aLen - 1], false, true) &&
+                if( isOnNumberChar(rStr[aLen - 1], false) &&
                     fValue >= 0.0 )
                 {
                     rStr.append( ' ' );
diff --git a/drawinglayer/source/primitive3d/polygonprimitive3d.cxx b/drawinglayer/source/primitive3d/polygonprimitive3d.cxx
index a1956d9786e6..89d85486e289 100644
--- a/drawinglayer/source/primitive3d/polygonprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/polygonprimitive3d.cxx
@@ -85,7 +85,7 @@ namespace drawinglayer
                 else
                 {
                     // apply LineStyle
-                    basegfx::utils::applyLineDashing(getB3DPolygon(), getStrokeAttribute().getDotDashArray(), &aHairLinePolyPolygon, nullptr, getStrokeAttribute().getFullDotDashLen());
+                    basegfx::utils::applyLineDashing(getB3DPolygon(), getStrokeAttribute().getDotDashArray(), &aHairLinePolyPolygon, getStrokeAttribute().getFullDotDashLen());
                 }
 
                 // prepare result
diff --git a/include/basegfx/polygon/b2dpolypolygontools.hxx b/include/basegfx/polygon/b2dpolypolygontools.hxx
index 3f34f8e6f7c5..8de5e6c90cc3 100644
--- a/include/basegfx/polygon/b2dpolypolygontools.hxx
+++ b/include/basegfx/polygon/b2dpolypolygontools.hxx
@@ -89,7 +89,6 @@ namespace basegfx
             const B2DPolyPolygon& rCandidate,
             const ::std::vector<double>& rDotDashArray,
             B2DPolyPolygon* pLineTarget,
-            B2DPolyPolygon* pGapTarget = nullptr,
             double fFullDashDotLen = 0.0);
 
         // test if point is inside epsilon-range around the given PolyPolygon. Can be used
@@ -277,16 +276,14 @@ namespace basegfx
 
         /// converters for css::drawing::PointSequence
         BASEGFX_DLLPUBLIC B2DPolyPolygon UnoPointSequenceSequenceToB2DPolyPolygon(
-            const css::drawing::PointSequenceSequence& rPointSequenceSequenceSource,
-            bool bCheckClosed = true);
+            const css::drawing::PointSequenceSequence& rPointSequenceSequenceSource);
         BASEGFX_DLLPUBLIC void B2DPolyPolygonToUnoPointSequenceSequence(
             const B2DPolyPolygon& rPolyPolygon,
             css::drawing::PointSequenceSequence& rPointSequenceSequenceRetval);
 
         /// converters for css::drawing::PolyPolygonBezierCoords (curved polygons)
         BASEGFX_DLLPUBLIC B2DPolyPolygon UnoPolyPolygonBezierCoordsToB2DPolyPolygon(
-            const css::drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoordsSource,
-            bool bCheckClosed = true);
+            const css::drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoordsSource);
         BASEGFX_DLLPUBLIC void B2DPolyPolygonToUnoPolyPolygonBezierCoords(
             const B2DPolyPolygon& rPolyPolygon,
             css::drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoordsRetval);
diff --git a/include/basegfx/polygon/b3dpolygontools.hxx b/include/basegfx/polygon/b3dpolygontools.hxx
index a38ece65f99c..5b54a112c2d8 100644
--- a/include/basegfx/polygon/b3dpolygontools.hxx
+++ b/include/basegfx/polygon/b3dpolygontools.hxx
@@ -65,7 +65,6 @@ namespace basegfx
             const B3DPolygon& rCandidate,
             const ::std::vector<double>& rDotDashArray,
             B3DPolyPolygon* pLineTarget,
-            B3DPolyPolygon* pGapTarget,
             double fFullDashDotLen = 0.0);
 
         /** Create/replace normals for given 3d geometry with default normals from given center to outside.
@@ -100,7 +99,7 @@ namespace basegfx
 
         // calculates if given point is on given polygon, taking care of the numerical epsilon. Uses
         // isPointOnLine internally
-        BASEGFX_DLLPUBLIC bool isPointOnPolygon(const B3DPolygon& rCandidate, const B3DPoint& rPoint, bool bWithPoints = true);
+        BASEGFX_DLLPUBLIC bool isPointOnPolygon(const B3DPolygon& rCandidate, const B3DPoint& rPoint);
 
         // helper to get a fCut position between a plane (given with normal and a point)
         // and a line given by start and end point
diff --git a/include/basegfx/polygon/b3dpolypolygontools.hxx b/include/basegfx/polygon/b3dpolypolygontools.hxx
index 72177230c1e7..b3105e21398b 100644
--- a/include/basegfx/polygon/b3dpolypolygontools.hxx
+++ b/include/basegfx/polygon/b3dpolypolygontools.hxx
@@ -121,14 +121,13 @@ namespace basegfx
          */
         BASEGFX_DLLPUBLIC B3DPolyPolygon applyDefaultTextureCoordinatesSphere( const B3DPolyPolygon& rCandidate, const B3DPoint& rCenter, bool bChangeX = true, bool bChangeY = true);
 
-        // isInside test for B3DPoint. On border is not inside as long as not true is given
-        // in bWithBorder flag. It is assumed that the orientations of the given polygon are correct.
-        BASEGFX_DLLPUBLIC bool isInside(const B3DPolyPolygon& rCandidate, const B3DPoint& rPoint, bool bWithBorder = false);
+        // isInside test for B3DPoint. On border is not inside.
+        // It is assumed that the orientations of the given polygon are correct.
+        BASEGFX_DLLPUBLIC bool isInside(const B3DPolyPolygon& rCandidate, const B3DPoint& rPoint);
 
         /// converters for css::drawing::PolyPolygonShape3D
         BASEGFX_DLLPUBLIC B3DPolyPolygon UnoPolyPolygonShape3DToB3DPolyPolygon(
-            const css::drawing::PolyPolygonShape3D& rPolyPolygonShape3DSource,
-            bool bCheckClosed = true);
+            const css::drawing::PolyPolygonShape3D& rPolyPolygonShape3DSource);
         BASEGFX_DLLPUBLIC void B3DPolyPolygonToUnoPolyPolygonShape3D(
             const B3DPolyPolygon& rPolyPolygonSource,
             css::drawing::PolyPolygonShape3D& rPolyPolygonShape3DRetval);


More information about the Libreoffice-commits mailing list