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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sun Apr 19 06:31:10 UTC 2020


 basegfx/source/color/bcolormodifier.cxx          |   44 -
 basegfx/source/curve/b2dcubicbezier.cxx          |  174 +++---
 basegfx/source/matrix/b2dhommatrix.cxx           |   24 
 basegfx/source/matrix/b3dhommatrix.cxx           |   70 +-
 basegfx/source/polygon/b2dpolygon.cxx            |  332 ++++++------
 basegfx/source/polygon/b2dpolygoncutandtouch.cxx |  632 +++++++++++------------
 basegfx/source/polygon/b2dpolygontools.cxx       |   68 +-
 basegfx/source/polygon/b2dpolypolygoncutter.cxx  |  144 ++---
 basegfx/source/polygon/b2dpolypolygontools.cxx   |   28 -
 basegfx/source/polygon/b2dtrapezoid.cxx          |   80 +-
 basegfx/source/polygon/b3dpolygon.cxx            |  372 ++++++-------
 basegfx/source/range/b3drange.cxx                |   26 
 basegfx/source/raster/rasterconvert3d.cxx        |  218 +++----
 13 files changed, 1106 insertions(+), 1106 deletions(-)

New commits:
commit 5dccf84b14ed0e09262411295c5880f787342d59
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat Apr 18 14:50:39 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Apr 19 08:30:31 2020 +0200

    loplugin:flatten in basegfx
    
    Change-Id: Ic8bc586e1a4977322dcb371c0fff6411783df9d7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92484
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/basegfx/source/color/bcolormodifier.cxx b/basegfx/source/color/bcolormodifier.cxx
index b98b19f98652..e2a2567288c6 100644
--- a/basegfx/source/color/bcolormodifier.cxx
+++ b/basegfx/source/color/bcolormodifier.cxx
@@ -232,33 +232,33 @@ namespace basegfx
         mfBlueOff(0.0),
         mbUseIt(false)
     {
-        if(!basegfx::fTools::equalZero(mfRed)
+        if(!(!basegfx::fTools::equalZero(mfRed)
             || !basegfx::fTools::equalZero(mfGreen)
             || !basegfx::fTools::equalZero(mfBlue)
             || !basegfx::fTools::equalZero(mfLuminance)
-            || !basegfx::fTools::equalZero(mfContrast))
+            || !basegfx::fTools::equalZero(mfContrast)))
+            return;
+
+        // calculate slope
+        if(mfContrast >= 0.0)
+        {
+            mfContrastOff = 128.0 / (128.0 - (mfContrast * 127.0));
+        }
+        else
         {
-            // calculate slope
-            if(mfContrast >= 0.0)
-            {
-                mfContrastOff = 128.0 / (128.0 - (mfContrast * 127.0));
-            }
-            else
-            {
-                mfContrastOff = ( 128.0 + (mfContrast * 127.0)) / 128.0;
-            }
-
-            // calculate unified contrast offset
-            const double fPreparedContrastOff((128.0 - mfContrastOff * 128.0) / 255.0);
-            const double fCombinedOffset(mfLuminance + fPreparedContrastOff);
-
-            // set full offsets
-            mfRedOff = mfRed + fCombinedOffset;
-            mfGreenOff = mfGreen + fCombinedOffset;
-            mfBlueOff = mfBlue + fCombinedOffset;
-
-            mbUseIt = true;
+            mfContrastOff = ( 128.0 + (mfContrast * 127.0)) / 128.0;
         }
+
+        // calculate unified contrast offset
+        const double fPreparedContrastOff((128.0 - mfContrastOff * 128.0) / 255.0);
+        const double fCombinedOffset(mfLuminance + fPreparedContrastOff);
+
+        // set full offsets
+        mfRedOff = mfRed + fCombinedOffset;
+        mfGreenOff = mfGreen + fCombinedOffset;
+        mfBlueOff = mfBlue + fCombinedOffset;
+
+        mbUseIt = true;
     }
 
     BColorModifier_RGBLuminanceContrast::~BColorModifier_RGBLuminanceContrast()
diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx
index e1fad1e8a552..4fd2e33fe299 100644
--- a/basegfx/source/curve/b2dcubicbezier.cxx
+++ b/basegfx/source/curve/b2dcubicbezier.cxx
@@ -381,86 +381,86 @@ namespace basegfx
 
     void B2DCubicBezier::testAndSolveTrivialBezier()
     {
-        if(maControlPointA != maStartPoint || maControlPointB != maEndPoint)
-        {
-            const B2DVector aEdge(maEndPoint - maStartPoint);
+        if(maControlPointA == maStartPoint && maControlPointB == maEndPoint)
+            return;
 
-            // controls parallel to edge can be trivial. No edge -> not parallel -> control can
-            // still not be trivial (e.g. ballon loop)
-            if(!aEdge.equalZero())
-            {
-                // get control vectors
-                const B2DVector aVecA(maControlPointA - maStartPoint);
-                const B2DVector aVecB(maControlPointB - maEndPoint);
-
-                // check if trivial per se
-                bool bAIsTrivial(aVecA.equalZero());
-                bool bBIsTrivial(aVecB.equalZero());
-
-                // #i102241# prepare inverse edge length to normalize cross values;
-                // else the small compare value used in fTools::equalZero
-                // will be length dependent and this detection will work as less
-                // precise as longer the edge is. In principle, the length of the control
-                // vector would need to be used too, but to be trivial it is assumed to
-                // be of roughly equal length to the edge, so edge length can be used
-                // for both. Only needed when one of both is not trivial per se.
-                const double fInverseEdgeLength(bAIsTrivial && bBIsTrivial
-                    ? 1.0
-                    : 1.0 / aEdge.getLength());
-
-                // if A is not zero, check if it could be
-                if(!bAIsTrivial)
-                {
-                    // #i102241# parallel to edge? Check aVecA, aEdge. Use cross() which does what
-                    // we need here with the precision we need
-                    const double fCross(aVecA.cross(aEdge) * fInverseEdgeLength);
+        const B2DVector aEdge(maEndPoint - maStartPoint);
 
-                    if(fTools::equalZero(fCross))
-                    {
-                        // get scale to edge. Use bigger distance for numeric quality
-                        const double fScale(fabs(aEdge.getX()) > fabs(aEdge.getY())
-                            ? aVecA.getX() / aEdge.getX()
-                            : aVecA.getY() / aEdge.getY());
+        // controls parallel to edge can be trivial. No edge -> not parallel -> control can
+        // still not be trivial (e.g. ballon loop)
+        if(aEdge.equalZero())
+            return;
 
-                        // relative end point of vector in edge range?
-                        if (fTools::betweenOrEqualEither(fScale, 0.0, 1.0))
-                        {
-                            bAIsTrivial = true;
-                        }
-                    }
-                }
+        // get control vectors
+        const B2DVector aVecA(maControlPointA - maStartPoint);
+        const B2DVector aVecB(maControlPointB - maEndPoint);
+
+        // check if trivial per se
+        bool bAIsTrivial(aVecA.equalZero());
+        bool bBIsTrivial(aVecB.equalZero());
+
+        // #i102241# prepare inverse edge length to normalize cross values;
+        // else the small compare value used in fTools::equalZero
+        // will be length dependent and this detection will work as less
+        // precise as longer the edge is. In principle, the length of the control
+        // vector would need to be used too, but to be trivial it is assumed to
+        // be of roughly equal length to the edge, so edge length can be used
+        // for both. Only needed when one of both is not trivial per se.
+        const double fInverseEdgeLength(bAIsTrivial && bBIsTrivial
+            ? 1.0
+            : 1.0 / aEdge.getLength());
+
+        // if A is not zero, check if it could be
+        if(!bAIsTrivial)
+        {
+            // #i102241# parallel to edge? Check aVecA, aEdge. Use cross() which does what
+            // we need here with the precision we need
+            const double fCross(aVecA.cross(aEdge) * fInverseEdgeLength);
 
-                // if B is not zero, check if it could be, but only if A is already trivial;
-                // else solve to trivial will not be possible for whole edge
-                if(bAIsTrivial && !bBIsTrivial)
+            if(fTools::equalZero(fCross))
+            {
+                // get scale to edge. Use bigger distance for numeric quality
+                const double fScale(fabs(aEdge.getX()) > fabs(aEdge.getY())
+                    ? aVecA.getX() / aEdge.getX()
+                    : aVecA.getY() / aEdge.getY());
+
+                // relative end point of vector in edge range?
+                if (fTools::betweenOrEqualEither(fScale, 0.0, 1.0))
                 {
-                    // parallel to edge? Check aVecB, aEdge
-                    const double fCross(aVecB.cross(aEdge) * fInverseEdgeLength);
+                    bAIsTrivial = true;
+                }
+            }
+        }
 
-                    if(fTools::equalZero(fCross))
-                    {
-                        // get scale to edge. Use bigger distance for numeric quality
-                        const double fScale(fabs(aEdge.getX()) > fabs(aEdge.getY())
-                            ? aVecB.getX() / aEdge.getX()
-                            : aVecB.getY() / aEdge.getY());
+        // if B is not zero, check if it could be, but only if A is already trivial;
+        // else solve to trivial will not be possible for whole edge
+        if(bAIsTrivial && !bBIsTrivial)
+        {
+            // parallel to edge? Check aVecB, aEdge
+            const double fCross(aVecB.cross(aEdge) * fInverseEdgeLength);
 
-                        // end point of vector in edge range? Caution: controlB is directed AGAINST edge
-                        if (fTools::betweenOrEqualEither(fScale, -1.0, 0.0))
-                        {
-                            bBIsTrivial = true;
-                        }
-                    }
-                }
+            if(fTools::equalZero(fCross))
+            {
+                // get scale to edge. Use bigger distance for numeric quality
+                const double fScale(fabs(aEdge.getX()) > fabs(aEdge.getY())
+                    ? aVecB.getX() / aEdge.getX()
+                    : aVecB.getY() / aEdge.getY());
 
-                // if both are/can be reduced, do it.
-                // Not possible if only one is/can be reduced (!)
-                if(bAIsTrivial && bBIsTrivial)
+                // end point of vector in edge range? Caution: controlB is directed AGAINST edge
+                if (fTools::betweenOrEqualEither(fScale, -1.0, 0.0))
                 {
-                    maControlPointA = maStartPoint;
-                    maControlPointB = maEndPoint;
+                    bBIsTrivial = true;
                 }
             }
         }
+
+        // if both are/can be reduced, do it.
+        // Not possible if only one is/can be reduced (!)
+        if(bAIsTrivial && bBIsTrivial)
+        {
+            maControlPointA = maStartPoint;
+            maControlPointB = maEndPoint;
+        }
     }
 
     namespace {
@@ -994,27 +994,27 @@ namespace basegfx
 
     void B2DCubicBezier::transform(const basegfx::B2DHomMatrix& rMatrix)
     {
-        if(!rMatrix.isIdentity())
+        if(rMatrix.isIdentity())
+            return;
+
+        if(maControlPointA == maStartPoint)
         {
-            if(maControlPointA == maStartPoint)
-            {
-                maControlPointA = maStartPoint = rMatrix * maStartPoint;
-            }
-            else
-            {
-                maStartPoint *= rMatrix;
-                maControlPointA *= rMatrix;
-            }
+            maControlPointA = maStartPoint = rMatrix * maStartPoint;
+        }
+        else
+        {
+            maStartPoint *= rMatrix;
+            maControlPointA *= rMatrix;
+        }
 
-            if(maControlPointB == maEndPoint)
-            {
-                maControlPointB = maEndPoint = rMatrix * maEndPoint;
-            }
-            else
-            {
-                maEndPoint *= rMatrix;
-                maControlPointB *= rMatrix;
-            }
+        if(maControlPointB == maEndPoint)
+        {
+            maControlPointB = maEndPoint = rMatrix * maEndPoint;
+        }
+        else
+        {
+            maEndPoint *= rMatrix;
+            maControlPointB *= rMatrix;
         }
     }
 
diff --git a/basegfx/source/matrix/b2dhommatrix.cxx b/basegfx/source/matrix/b2dhommatrix.cxx
index 61178c496011..89088e8ebdbf 100644
--- a/basegfx/source/matrix/b2dhommatrix.cxx
+++ b/basegfx/source/matrix/b2dhommatrix.cxx
@@ -181,21 +181,21 @@ namespace basegfx
 
     void B2DHomMatrix::rotate(double fRadiant)
     {
-        if(!fTools::equalZero(fRadiant))
-        {
-            double fSin(0.0);
-            double fCos(1.0);
+        if(fTools::equalZero(fRadiant))
+            return;
 
-            utils::createSinCosOrthogonal(fSin, fCos, fRadiant);
-            Impl2DHomMatrix aRotMat;
+        double fSin(0.0);
+        double fCos(1.0);
 
-            aRotMat.set(0, 0, fCos);
-            aRotMat.set(1, 1, fCos);
-            aRotMat.set(1, 0, fSin);
-            aRotMat.set(0, 1, -fSin);
+        utils::createSinCosOrthogonal(fSin, fCos, fRadiant);
+        Impl2DHomMatrix aRotMat;
 
-            mpImpl->doMulMatrix(aRotMat);
-        }
+        aRotMat.set(0, 0, fCos);
+        aRotMat.set(1, 1, fCos);
+        aRotMat.set(1, 0, fSin);
+        aRotMat.set(0, 1, -fSin);
+
+        mpImpl->doMulMatrix(aRotMat);
     }
 
     void B2DHomMatrix::translate(double fX, double fY)
diff --git a/basegfx/source/matrix/b3dhommatrix.cxx b/basegfx/source/matrix/b3dhommatrix.cxx
index e3f3d3d28475..2a56c7a28795 100644
--- a/basegfx/source/matrix/b3dhommatrix.cxx
+++ b/basegfx/source/matrix/b3dhommatrix.cxx
@@ -149,50 +149,50 @@ namespace basegfx
 
     void B3DHomMatrix::rotate(double fAngleX,double fAngleY,double fAngleZ)
     {
-        if(!fTools::equalZero(fAngleX) || !fTools::equalZero(fAngleY) || !fTools::equalZero(fAngleZ))
+        if(!(!fTools::equalZero(fAngleX) || !fTools::equalZero(fAngleY) || !fTools::equalZero(fAngleZ)))
+            return;
+
+        if(!fTools::equalZero(fAngleX))
         {
-            if(!fTools::equalZero(fAngleX))
-            {
-                Impl3DHomMatrix aRotMatX;
-                double fSin(sin(fAngleX));
-                double fCos(cos(fAngleX));
+            Impl3DHomMatrix aRotMatX;
+            double fSin(sin(fAngleX));
+            double fCos(cos(fAngleX));
 
-                aRotMatX.set(1, 1, fCos);
-                aRotMatX.set(2, 2, fCos);
-                aRotMatX.set(2, 1, fSin);
-                aRotMatX.set(1, 2, -fSin);
+            aRotMatX.set(1, 1, fCos);
+            aRotMatX.set(2, 2, fCos);
+            aRotMatX.set(2, 1, fSin);
+            aRotMatX.set(1, 2, -fSin);
 
-                mpImpl->doMulMatrix(aRotMatX);
-            }
+            mpImpl->doMulMatrix(aRotMatX);
+        }
 
-            if(!fTools::equalZero(fAngleY))
-            {
-                Impl3DHomMatrix aRotMatY;
-                double fSin(sin(fAngleY));
-                double fCos(cos(fAngleY));
+        if(!fTools::equalZero(fAngleY))
+        {
+            Impl3DHomMatrix aRotMatY;
+            double fSin(sin(fAngleY));
+            double fCos(cos(fAngleY));
 
-                aRotMatY.set(0, 0, fCos);
-                aRotMatY.set(2, 2, fCos);
-                aRotMatY.set(0, 2, fSin);
-                aRotMatY.set(2, 0, -fSin);
+            aRotMatY.set(0, 0, fCos);
+            aRotMatY.set(2, 2, fCos);
+            aRotMatY.set(0, 2, fSin);
+            aRotMatY.set(2, 0, -fSin);
 
-                mpImpl->doMulMatrix(aRotMatY);
-            }
+            mpImpl->doMulMatrix(aRotMatY);
+        }
 
-            if(!fTools::equalZero(fAngleZ))
-            {
-                Impl3DHomMatrix aRotMatZ;
-                double fSin(sin(fAngleZ));
-                double fCos(cos(fAngleZ));
+        if(fTools::equalZero(fAngleZ))
+            return;
 
-                aRotMatZ.set(0, 0, fCos);
-                aRotMatZ.set(1, 1, fCos);
-                aRotMatZ.set(1, 0, fSin);
-                aRotMatZ.set(0, 1, -fSin);
+        Impl3DHomMatrix aRotMatZ;
+        double fSin(sin(fAngleZ));
+        double fCos(cos(fAngleZ));
 
-                mpImpl->doMulMatrix(aRotMatZ);
-            }
-        }
+        aRotMatZ.set(0, 0, fCos);
+        aRotMatZ.set(1, 1, fCos);
+        aRotMatZ.set(1, 0, fSin);
+        aRotMatZ.set(0, 1, -fSin);
+
+        mpImpl->doMulMatrix(aRotMatZ);
     }
 
     void B3DHomMatrix::rotate(const B3DTuple& rRotation)
diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx
index 4cf280cd5b91..18695ec2be19 100644
--- a/basegfx/source/polygon/b2dpolygon.cxx
+++ b/basegfx/source/polygon/b2dpolygon.cxx
@@ -139,20 +139,20 @@ public:
 
     void flip(bool bIsClosed)
     {
-        if(maVector.size() > 1)
-        {
-            // to keep the same point at index 0, just flip all points except the
-            // first one when closed
-            const sal_uInt32 nHalfSize(bIsClosed ? (maVector.size() - 1) >> 1 : maVector.size() >> 1);
-            CoordinateData2DVector::iterator aStart(bIsClosed ? maVector.begin() + 1 : maVector.begin());
-            CoordinateData2DVector::iterator aEnd(maVector.end() - 1);
+        if(maVector.size() <= 1)
+            return;
 
-            for(sal_uInt32 a(0); a < nHalfSize; a++)
-            {
-                std::swap(*aStart, *aEnd);
-                ++aStart;
-                --aEnd;
-            }
+        // to keep the same point at index 0, just flip all points except the
+        // first one when closed
+        const sal_uInt32 nHalfSize(bIsClosed ? (maVector.size() - 1) >> 1 : maVector.size() >> 1);
+        CoordinateData2DVector::iterator aStart(bIsClosed ? maVector.begin() + 1 : maVector.begin());
+        CoordinateData2DVector::iterator aEnd(maVector.end() - 1);
+
+        for(sal_uInt32 a(0); a < nHalfSize; a++)
+        {
+            std::swap(*aStart, *aEnd);
+            ++aStart;
+            --aEnd;
         }
     }
 
@@ -359,101 +359,101 @@ public:
 
     void insert(sal_uInt32 nIndex, const ControlVectorPair2D& rValue, sal_uInt32 nCount)
     {
-        if(nCount)
-        {
-            // add nCount copies of rValue
-            ControlVectorPair2DVector::iterator aIndex(maVector.begin());
-            aIndex += nIndex;
-            maVector.insert(aIndex, nCount, rValue);
+        if(!nCount)
+            return;
 
-            if(!rValue.getPrevVector().equalZero())
-                mnUsedVectors += nCount;
+        // add nCount copies of rValue
+        ControlVectorPair2DVector::iterator aIndex(maVector.begin());
+        aIndex += nIndex;
+        maVector.insert(aIndex, nCount, rValue);
 
-            if(!rValue.getNextVector().equalZero())
-                mnUsedVectors += nCount;
-        }
+        if(!rValue.getPrevVector().equalZero())
+            mnUsedVectors += nCount;
+
+        if(!rValue.getNextVector().equalZero())
+            mnUsedVectors += nCount;
     }
 
     void insert(sal_uInt32 nIndex, const ControlVectorArray2D& rSource)
     {
         const sal_uInt32 nCount(rSource.maVector.size());
 
-        if(nCount)
-        {
-            // insert data
-            ControlVectorPair2DVector::iterator aIndex(maVector.begin());
-            aIndex += nIndex;
-            ControlVectorPair2DVector::const_iterator aStart(rSource.maVector.begin());
-            ControlVectorPair2DVector::const_iterator aEnd(rSource.maVector.end());
-            maVector.insert(aIndex, aStart, aEnd);
+        if(!nCount)
+            return;
 
-            for(; aStart != aEnd; ++aStart)
-            {
-                if(!aStart->getPrevVector().equalZero())
-                    mnUsedVectors++;
+        // insert data
+        ControlVectorPair2DVector::iterator aIndex(maVector.begin());
+        aIndex += nIndex;
+        ControlVectorPair2DVector::const_iterator aStart(rSource.maVector.begin());
+        ControlVectorPair2DVector::const_iterator aEnd(rSource.maVector.end());
+        maVector.insert(aIndex, aStart, aEnd);
 
-                if(!aStart->getNextVector().equalZero())
-                    mnUsedVectors++;
-            }
+        for(; aStart != aEnd; ++aStart)
+        {
+            if(!aStart->getPrevVector().equalZero())
+                mnUsedVectors++;
+
+            if(!aStart->getNextVector().equalZero())
+                mnUsedVectors++;
         }
     }
 
     void remove(sal_uInt32 nIndex, sal_uInt32 nCount)
     {
-        if(nCount)
-        {
-            const ControlVectorPair2DVector::iterator aDeleteStart(maVector.begin() + nIndex);
-            const ControlVectorPair2DVector::iterator aDeleteEnd(aDeleteStart + nCount);
-            ControlVectorPair2DVector::const_iterator aStart(aDeleteStart);
+        if(!nCount)
+            return;
 
-            for(; mnUsedVectors && aStart != aDeleteEnd; ++aStart)
-            {
-                if(!aStart->getPrevVector().equalZero())
-                    mnUsedVectors--;
+        const ControlVectorPair2DVector::iterator aDeleteStart(maVector.begin() + nIndex);
+        const ControlVectorPair2DVector::iterator aDeleteEnd(aDeleteStart + nCount);
+        ControlVectorPair2DVector::const_iterator aStart(aDeleteStart);
 
-                if(mnUsedVectors && !aStart->getNextVector().equalZero())
-                    mnUsedVectors--;
-            }
+        for(; mnUsedVectors && aStart != aDeleteEnd; ++aStart)
+        {
+            if(!aStart->getPrevVector().equalZero())
+                mnUsedVectors--;
 
-            // remove point data
-            maVector.erase(aDeleteStart, aDeleteEnd);
+            if(mnUsedVectors && !aStart->getNextVector().equalZero())
+                mnUsedVectors--;
         }
+
+        // remove point data
+        maVector.erase(aDeleteStart, aDeleteEnd);
     }
 
     void flip(bool bIsClosed)
     {
-        if(maVector.size() > 1)
-        {
-            // to keep the same point at index 0, just flip all points except the
-            // first one when closed
-            const sal_uInt32 nHalfSize(bIsClosed ? (maVector.size() - 1) >> 1 : maVector.size() >> 1);
-            ControlVectorPair2DVector::iterator aStart(bIsClosed ? maVector.begin() + 1 : maVector.begin());
-            ControlVectorPair2DVector::iterator aEnd(maVector.end() - 1);
+        if(maVector.size() <= 1)
+            return;
 
-            for(sal_uInt32 a(0); a < nHalfSize; a++)
-            {
-                // swap Prev and Next
-                aStart->flip();
-                aEnd->flip();
+        // to keep the same point at index 0, just flip all points except the
+        // first one when closed
+        const sal_uInt32 nHalfSize(bIsClosed ? (maVector.size() - 1) >> 1 : maVector.size() >> 1);
+        ControlVectorPair2DVector::iterator aStart(bIsClosed ? maVector.begin() + 1 : maVector.begin());
+        ControlVectorPair2DVector::iterator aEnd(maVector.end() - 1);
 
-                // swap entries
-                std::swap(*aStart, *aEnd);
+        for(sal_uInt32 a(0); a < nHalfSize; a++)
+        {
+            // swap Prev and Next
+            aStart->flip();
+            aEnd->flip();
 
-                ++aStart;
-                --aEnd;
-            }
+            // swap entries
+            std::swap(*aStart, *aEnd);
 
-            if(aStart == aEnd)
-            {
-                // swap Prev and Next at middle element (if exists)
-                aStart->flip();
-            }
+            ++aStart;
+            --aEnd;
+        }
 
-            if(bIsClosed)
-            {
-                // swap Prev and Next at start element
-                maVector.begin()->flip();
-            }
+        if(aStart == aEnd)
+        {
+            // swap Prev and Next at middle element (if exists)
+            aStart->flip();
+        }
+
+        if(bIsClosed)
+        {
+            // swap Prev and Next at start element
+            maVector.begin()->flip();
         }
     }
 };
@@ -858,63 +858,63 @@ public:
     {
         const sal_uInt32 nCount(rSource.maPoints.count());
 
-        if(nCount)
-        {
-            mpBufferedData.reset();
+        if(!nCount)
+            return;
 
-            if(rSource.mpControlVector && rSource.mpControlVector->isUsed() && !mpControlVector)
-            {
-                mpControlVector.reset( new ControlVectorArray2D(maPoints.count()) );
-            }
+        mpBufferedData.reset();
 
-            maPoints.insert(nIndex, rSource.maPoints);
+        if(rSource.mpControlVector && rSource.mpControlVector->isUsed() && !mpControlVector)
+        {
+            mpControlVector.reset( new ControlVectorArray2D(maPoints.count()) );
+        }
 
-            if(rSource.mpControlVector)
-            {
-                mpControlVector->insert(nIndex, *rSource.mpControlVector);
+        maPoints.insert(nIndex, rSource.maPoints);
 
-                if(!mpControlVector->isUsed())
-                    mpControlVector.reset();
-            }
-            else if(mpControlVector)
-            {
-                ControlVectorPair2D aVectorPair;
-                mpControlVector->insert(nIndex, aVectorPair, nCount);
-            }
+        if(rSource.mpControlVector)
+        {
+            mpControlVector->insert(nIndex, *rSource.mpControlVector);
+
+            if(!mpControlVector->isUsed())
+                mpControlVector.reset();
+        }
+        else if(mpControlVector)
+        {
+            ControlVectorPair2D aVectorPair;
+            mpControlVector->insert(nIndex, aVectorPair, nCount);
         }
     }
 
     void remove(sal_uInt32 nIndex, sal_uInt32 nCount)
     {
-        if(nCount)
-        {
-            mpBufferedData.reset();
-            maPoints.remove(nIndex, nCount);
+        if(!nCount)
+            return;
 
-            if(mpControlVector)
-            {
-                mpControlVector->remove(nIndex, nCount);
+        mpBufferedData.reset();
+        maPoints.remove(nIndex, nCount);
 
-                if(!mpControlVector->isUsed())
-                    mpControlVector.reset();
-            }
+        if(mpControlVector)
+        {
+            mpControlVector->remove(nIndex, nCount);
+
+            if(!mpControlVector->isUsed())
+                mpControlVector.reset();
         }
     }
 
     void flip()
     {
-        if(maPoints.count() > 1)
-        {
-            mpBufferedData.reset();
+        if(maPoints.count() <= 1)
+            return;
 
-            // flip points
-            maPoints.flip(mbIsClosed);
+        mpBufferedData.reset();
 
-            if(mpControlVector)
-            {
-                // flip control vector
-                mpControlVector->flip(mbIsClosed);
-            }
+        // flip points
+        maPoints.flip(mbIsClosed);
+
+        if(mpControlVector)
+        {
+            // flip control vector
+            mpControlVector->flip(mbIsClosed);
         }
     }
 
@@ -966,56 +966,56 @@ public:
     void removeDoublePointsAtBeginEnd()
     {
         // Only remove DoublePoints at Begin and End when poly is closed
-        if(mbIsClosed)
+        if(!mbIsClosed)
+            return;
+
+        mpBufferedData.reset();
+
+        if(mpControlVector)
         {
-            mpBufferedData.reset();
+            bool bRemove;
 
-            if(mpControlVector)
+            do
             {
-                bool bRemove;
+                bRemove = false;
 
-                do
+                if(maPoints.count() > 1)
                 {
-                    bRemove = false;
+                    const sal_uInt32 nIndex(maPoints.count() - 1);
 
-                    if(maPoints.count() > 1)
+                    if(maPoints.getCoordinate(0) == maPoints.getCoordinate(nIndex))
                     {
-                        const sal_uInt32 nIndex(maPoints.count() - 1);
-
-                        if(maPoints.getCoordinate(0) == maPoints.getCoordinate(nIndex))
+                        if(mpControlVector)
                         {
-                            if(mpControlVector)
-                            {
-                                if(mpControlVector->getNextVector(nIndex).equalZero() && mpControlVector->getPrevVector(0).equalZero())
-                                {
-                                    bRemove = true;
-                                }
-                            }
-                            else
+                            if(mpControlVector->getNextVector(nIndex).equalZero() && mpControlVector->getPrevVector(0).equalZero())
                             {
                                 bRemove = true;
                             }
                         }
-                    }
-
-                    if(bRemove)
-                    {
-                        const sal_uInt32 nIndex(maPoints.count() - 1);
-
-                        if(mpControlVector && !mpControlVector->getPrevVector(nIndex).equalZero())
+                        else
                         {
-                            mpControlVector->setPrevVector(0, mpControlVector->getPrevVector(nIndex));
+                            bRemove = true;
                         }
+                    }
+                }
 
-                        remove(nIndex, 1);
+                if(bRemove)
+                {
+                    const sal_uInt32 nIndex(maPoints.count() - 1);
+
+                    if(mpControlVector && !mpControlVector->getPrevVector(nIndex).equalZero())
+                    {
+                        mpControlVector->setPrevVector(0, mpControlVector->getPrevVector(nIndex));
                     }
+
+                    remove(nIndex, 1);
                 }
-                while(bRemove);
-            }
-            else
-            {
-                maPoints.removeDoublePointsAtBeginEnd();
             }
+            while(bRemove);
+        }
+        else
+        {
+            maPoints.removeDoublePointsAtBeginEnd();
         }
     }
 
@@ -1438,23 +1438,23 @@ namespace basegfx
 
     void B2DPolygon::append(const B2DPolygon& rPoly, sal_uInt32 nIndex, sal_uInt32 nCount)
     {
-        if(rPoly.count())
+        if(!rPoly.count())
+            return;
+
+        if(!nCount)
         {
-            if(!nCount)
-            {
-                nCount = rPoly.count();
-            }
+            nCount = rPoly.count();
+        }
 
-            if(nIndex == 0 && nCount == rPoly.count())
-            {
-                mpPolygon->insert(mpPolygon->count(), *rPoly.mpPolygon);
-            }
-            else
-            {
-                OSL_ENSURE(nIndex + nCount <= rPoly.mpPolygon->count(), "B2DPolygon Append outside range (!)");
-                ImplB2DPolygon aTempPoly(*rPoly.mpPolygon, nIndex, nCount);
-                mpPolygon->insert(mpPolygon->count(), aTempPoly);
-            }
+        if(nIndex == 0 && nCount == rPoly.count())
+        {
+            mpPolygon->insert(mpPolygon->count(), *rPoly.mpPolygon);
+        }
+        else
+        {
+            OSL_ENSURE(nIndex + nCount <= rPoly.mpPolygon->count(), "B2DPolygon Append outside range (!)");
+            ImplB2DPolygon aTempPoly(*rPoly.mpPolygon, nIndex, nCount);
+            mpPolygon->insert(mpPolygon->count(), aTempPoly);
         }
     }
 
diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
index d96a38ac7f30..a8ae6372d5ea 100644
--- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
+++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
@@ -214,48 +214,48 @@ namespace basegfx
             temporaryPointVector& rTempPointsA, temporaryPointVector& rTempPointsB)
         {
             // no null length edges
-            if(!(rCurrA.equal(rNextA) || rCurrB.equal(rNextB)))
-            {
-                // no common start/end points, this can be no cuts
-                if(!(rCurrB.equal(rCurrA) || rCurrB.equal(rNextA) || rNextB.equal(rCurrA) || rNextB.equal(rNextA)))
-                {
-                    const B2DVector aVecA(rNextA - rCurrA);
-                    const B2DVector aVecB(rNextB - rCurrB);
-                    double fCut(aVecA.cross(aVecB));
+            if(rCurrA.equal(rNextA) || rCurrB.equal(rNextB))
+                return;
 
-                    if(!fTools::equalZero(fCut))
-                    {
-                        const double fZero(0.0);
-                        const double fOne(1.0);
-                        fCut = (aVecB.getY() * (rCurrB.getX() - rCurrA.getX()) + aVecB.getX() * (rCurrA.getY() - rCurrB.getY())) / fCut;
+            // no common start/end points, this can be no cuts
+            if(rCurrB.equal(rCurrA) || rCurrB.equal(rNextA) || rNextB.equal(rCurrA) || rNextB.equal(rNextA))
+                return;
 
-                        if (fTools::betweenOrEqualEither(fCut, fZero, fOne))
-                        {
-                            // it's a candidate, but also need to test parameter value of cut on line 2
-                            double fCut2;
+            const B2DVector aVecA(rNextA - rCurrA);
+            const B2DVector aVecB(rNextB - rCurrB);
+            double fCut(aVecA.cross(aVecB));
 
-                            // choose the more precise version
-                            if(fabs(aVecB.getX()) > fabs(aVecB.getY()))
-                            {
-                                fCut2 = (rCurrA.getX() + (fCut * aVecA.getX()) - rCurrB.getX()) / aVecB.getX();
-                            }
-                            else
-                            {
-                                fCut2 = (rCurrA.getY() + (fCut * aVecA.getY()) - rCurrB.getY()) / aVecB.getY();
-                            }
+            if(fTools::equalZero(fCut))
+                return;
 
-                            if (fTools::betweenOrEqualEither(fCut2, fZero, fOne))
-                            {
-                                // cut is in range, add point. Two edges can have only one cut, but
-                                // add a cut point to each list. The lists may be the same for
-                                // self intersections.
-                                const B2DPoint aCutPoint(interpolate(rCurrA, rNextA, fCut));
-                                rTempPointsA.emplace_back(aCutPoint, nIndA, fCut);
-                                rTempPointsB.emplace_back(aCutPoint, nIndB, fCut2);
-                            }
-                        }
-                    }
-                }
+            const double fZero(0.0);
+            const double fOne(1.0);
+            fCut = (aVecB.getY() * (rCurrB.getX() - rCurrA.getX()) + aVecB.getX() * (rCurrA.getY() - rCurrB.getY())) / fCut;
+
+            if (!fTools::betweenOrEqualEither(fCut, fZero, fOne))
+                return;
+
+            // it's a candidate, but also need to test parameter value of cut on line 2
+            double fCut2;
+
+            // choose the more precise version
+            if(fabs(aVecB.getX()) > fabs(aVecB.getY()))
+            {
+                fCut2 = (rCurrA.getX() + (fCut * aVecA.getX()) - rCurrB.getX()) / aVecB.getX();
+            }
+            else
+            {
+                fCut2 = (rCurrA.getY() + (fCut * aVecA.getY()) - rCurrB.getY()) / aVecB.getY();
+            }
+
+            if (fTools::betweenOrEqualEither(fCut2, fZero, fOne))
+            {
+                // cut is in range, add point. Two edges can have only one cut, but
+                // add a cut point to each list. The lists may be the same for
+                // self intersections.
+                const B2DPoint aCutPoint(interpolate(rCurrA, rNextA, fCut));
+                rTempPointsA.emplace_back(aCutPoint, nIndA, fCut);
+                rTempPointsB.emplace_back(aCutPoint, nIndB, fCut2);
             }
         }
 
@@ -278,104 +278,104 @@ namespace basegfx
             const sal_uInt32 nPointCountA(rCandidateA.count());
             const sal_uInt32 nPointCountB(rCandidateB.count());
 
-            if(nPointCountA > 1 && nPointCountB > 1)
+            if(!(nPointCountA > 1 && nPointCountB > 1))
+                return;
+
+            const sal_uInt32 nEdgeCountA(nPointCountA - 1);
+            const sal_uInt32 nEdgeCountB(nPointCountB - 1);
+            B2DPoint aCurrA(rCandidateA.getB2DPoint(0));
+
+            for(sal_uInt32 a(0); a < nEdgeCountA; a++)
             {
-                const sal_uInt32 nEdgeCountA(nPointCountA - 1);
-                const sal_uInt32 nEdgeCountB(nPointCountB - 1);
-                B2DPoint aCurrA(rCandidateA.getB2DPoint(0));
+                const B2DPoint aNextA(rCandidateA.getB2DPoint(a + 1));
+                const B2DRange aRangeA(aCurrA, aNextA);
+                B2DPoint aCurrB(rCandidateB.getB2DPoint(0));
 
-                for(sal_uInt32 a(0); a < nEdgeCountA; a++)
+                for(sal_uInt32 b(0); b < nEdgeCountB; b++)
                 {
-                    const B2DPoint aNextA(rCandidateA.getB2DPoint(a + 1));
-                    const B2DRange aRangeA(aCurrA, aNextA);
-                    B2DPoint aCurrB(rCandidateB.getB2DPoint(0));
+                    const B2DPoint aNextB(rCandidateB.getB2DPoint(b + 1));
+                    const B2DRange aRangeB(aCurrB, aNextB);
 
-                    for(sal_uInt32 b(0); b < nEdgeCountB; b++)
+                    if(aRangeA.overlaps(aRangeB))
                     {
-                        const B2DPoint aNextB(rCandidateB.getB2DPoint(b + 1));
-                        const B2DRange aRangeB(aCurrB, aNextB);
-
-                        if(aRangeA.overlaps(aRangeB))
+                        // no null length edges
+                        if(!(aCurrA.equal(aNextA) || aCurrB.equal(aNextB)))
                         {
-                            // no null length edges
-                            if(!(aCurrA.equal(aNextA) || aCurrB.equal(aNextB)))
+                            const B2DVector aVecA(aNextA - aCurrA);
+                            const B2DVector aVecB(aNextB - aCurrB);
+                            double fCutA(aVecA.cross(aVecB));
+
+                            if(!fTools::equalZero(fCutA))
                             {
-                                const B2DVector aVecA(aNextA - aCurrA);
-                                const B2DVector aVecB(aNextB - aCurrB);
-                                double fCutA(aVecA.cross(aVecB));
+                                const double fZero(0.0);
+                                const double fOne(1.0);
+                                fCutA = (aVecB.getY() * (aCurrB.getX() - aCurrA.getX()) + aVecB.getX() * (aCurrA.getY() - aCurrB.getY())) / fCutA;
 
-                                if(!fTools::equalZero(fCutA))
+                                // use range [0.0 .. 1.0[, thus in the loop, all direct aCurrA cuts will be registered
+                                // as 0.0 cut. The 1.0 cut will be registered in the next loop step
+                                if(fTools::moreOrEqual(fCutA, fZero) && fTools::less(fCutA, fOne))
                                 {
-                                    const double fZero(0.0);
-                                    const double fOne(1.0);
-                                    fCutA = (aVecB.getY() * (aCurrB.getX() - aCurrA.getX()) + aVecB.getX() * (aCurrA.getY() - aCurrB.getY())) / fCutA;
+                                    // it's a candidate, but also need to test parameter value of cut on line 2
+                                    double fCutB;
+
+                                    // choose the more precise version
+                                    if(fabs(aVecB.getX()) > fabs(aVecB.getY()))
+                                    {
+                                        fCutB = (aCurrA.getX() + (fCutA * aVecA.getX()) - aCurrB.getX()) / aVecB.getX();
+                                    }
+                                    else
+                                    {
+                                        fCutB = (aCurrA.getY() + (fCutA * aVecA.getY()) - aCurrB.getY()) / aVecB.getY();
+                                    }
 
                                     // use range [0.0 .. 1.0[, thus in the loop, all direct aCurrA cuts will be registered
                                     // as 0.0 cut. The 1.0 cut will be registered in the next loop step
-                                    if(fTools::moreOrEqual(fCutA, fZero) && fTools::less(fCutA, fOne))
+                                    if(fTools::moreOrEqual(fCutB, fZero) && fTools::less(fCutB, fOne))
                                     {
-                                        // it's a candidate, but also need to test parameter value of cut on line 2
-                                        double fCutB;
-
-                                        // choose the more precise version
-                                        if(fabs(aVecB.getX()) > fabs(aVecB.getY()))
+                                        // cut is in both ranges. Add points for A and B
+                                        // #i111715# use fTools::equal instead of fTools::equalZero for better accuracy
+                                        if(fTools::equal(fCutA, fZero))
                                         {
-                                            fCutB = (aCurrA.getX() + (fCutA * aVecA.getX()) - aCurrB.getX()) / aVecB.getX();
+                                            // ignore for start point in first edge; this is handled
+                                            // by outer methods and would just produce a double point
+                                            if(a)
+                                            {
+                                                rTempPointsA.emplace_back(aCurrA, a, 0.0);
+                                            }
                                         }
                                         else
                                         {
-                                            fCutB = (aCurrA.getY() + (fCutA * aVecA.getY()) - aCurrB.getY()) / aVecB.getY();
+                                            const B2DPoint aCutPoint(interpolate(aCurrA, aNextA, fCutA));
+                                            rTempPointsA.emplace_back(aCutPoint, a, fCutA);
                                         }
 
-                                        // use range [0.0 .. 1.0[, thus in the loop, all direct aCurrA cuts will be registered
-                                        // as 0.0 cut. The 1.0 cut will be registered in the next loop step
-                                        if(fTools::moreOrEqual(fCutB, fZero) && fTools::less(fCutB, fOne))
+                                        // #i111715# use fTools::equal instead of fTools::equalZero for better accuracy
+                                        if(fTools::equal(fCutB, fZero))
                                         {
-                                            // cut is in both ranges. Add points for A and B
-                                            // #i111715# use fTools::equal instead of fTools::equalZero for better accuracy
-                                            if(fTools::equal(fCutA, fZero))
-                                            {
-                                                // ignore for start point in first edge; this is handled
-                                                // by outer methods and would just produce a double point
-                                                if(a)
-                                                {
-                                                    rTempPointsA.emplace_back(aCurrA, a, 0.0);
-                                                }
-                                            }
-                                            else
-                                            {
-                                                const B2DPoint aCutPoint(interpolate(aCurrA, aNextA, fCutA));
-                                                rTempPointsA.emplace_back(aCutPoint, a, fCutA);
-                                            }
-
-                                            // #i111715# use fTools::equal instead of fTools::equalZero for better accuracy
-                                            if(fTools::equal(fCutB, fZero))
+                                            // ignore for start point in first edge; this is handled
+                                            // by outer methods and would just produce a double point
+                                            if(b)
                                             {
-                                                // ignore for start point in first edge; this is handled
-                                                // by outer methods and would just produce a double point
-                                                if(b)
-                                                {
-                                                    rTempPointsB.emplace_back(aCurrB, b, 0.0);
-                                                }
-                                            }
-                                            else
-                                            {
-                                                const B2DPoint aCutPoint(interpolate(aCurrB, aNextB, fCutB));
-                                                rTempPointsB.emplace_back(aCutPoint, b, fCutB);
+                                                rTempPointsB.emplace_back(aCurrB, b, 0.0);
                                             }
                                         }
+                                        else
+                                        {
+                                            const B2DPoint aCutPoint(interpolate(aCurrB, aNextB, fCutB));
+                                            rTempPointsB.emplace_back(aCutPoint, b, fCutB);
+                                        }
                                     }
                                 }
                             }
                         }
-
-                        // prepare next step
-                        aCurrB = aNextB;
                     }
 
                     // prepare next step
-                    aCurrA = aNextA;
+                    aCurrB = aNextB;
                 }
+
+                // prepare next step
+                aCurrA = aNextA;
             }
         }
 
@@ -493,107 +493,107 @@ namespace basegfx
             // entries to rTempPoints accordingly
             const sal_uInt32 nPointCount(rCandidate.count());
 
-            if(nPointCount)
+            if(!nPointCount)
+                return;
+
+            const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nPointCount : nPointCount - 1);
+
+            if(!nEdgeCount)
+                return;
+
+            const bool bCurvesInvolved(rCandidate.areControlPointsUsed());
+
+            if(bCurvesInvolved)
             {
-                const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nPointCount : nPointCount - 1);
+                B2DCubicBezier aCubicA;
+                B2DCubicBezier aCubicB;
 
-                if(nEdgeCount)
+                for(sal_uInt32 a(0); a < nEdgeCount - 1; a++)
                 {
-                    const bool bCurvesInvolved(rCandidate.areControlPointsUsed());
+                    rCandidate.getBezierSegment(a, aCubicA);
+                    aCubicA.testAndSolveTrivialBezier();
+                    const bool bEdgeAIsCurve(aCubicA.isBezier());
+                    const B2DRange aRangeA(aCubicA.getRange());
 
-                    if(bCurvesInvolved)
+                    if(bEdgeAIsCurve)
                     {
-                        B2DCubicBezier aCubicA;
-                        B2DCubicBezier aCubicB;
+                        // curved segments may have self-intersections, do not forget those (!)
+                        findEdgeCutsOneBezier(aCubicA, a, rTempPoints);
+                    }
 
-                        for(sal_uInt32 a(0); a < nEdgeCount - 1; a++)
+                    for(sal_uInt32 b(a + 1); b < nEdgeCount; b++)
+                    {
+                        rCandidate.getBezierSegment(b, aCubicB);
+                        aCubicB.testAndSolveTrivialBezier();
+                        const B2DRange aRangeB(aCubicB.getRange());
+
+                        // only overlapping segments need to be tested
+                        // consecutive segments touch of course
+                        bool bOverlap = false;
+                        if( b > a+1)
+                            bOverlap = aRangeA.overlaps(aRangeB);
+                        else
+                            bOverlap = aRangeA.overlapsMore(aRangeB);
+                        if( bOverlap)
                         {
-                            rCandidate.getBezierSegment(a, aCubicA);
-                            aCubicA.testAndSolveTrivialBezier();
-                            const bool bEdgeAIsCurve(aCubicA.isBezier());
-                            const B2DRange aRangeA(aCubicA.getRange());
-
-                            if(bEdgeAIsCurve)
+                            const bool bEdgeBIsCurve(aCubicB.isBezier());
+                            if(bEdgeAIsCurve && bEdgeBIsCurve)
                             {
-                                // curved segments may have self-intersections, do not forget those (!)
-                                findEdgeCutsOneBezier(aCubicA, a, rTempPoints);
+                                // test for bezier-bezier cuts
+                                findEdgeCutsTwoBeziers(aCubicA, aCubicB, a, b, rTempPoints, rTempPoints);
                             }
-
-                            for(sal_uInt32 b(a + 1); b < nEdgeCount; b++)
+                            else if(bEdgeAIsCurve)
                             {
-                                rCandidate.getBezierSegment(b, aCubicB);
-                                aCubicB.testAndSolveTrivialBezier();
-                                const B2DRange aRangeB(aCubicB.getRange());
-
-                                // only overlapping segments need to be tested
-                                // consecutive segments touch of course
-                                bool bOverlap = false;
-                                if( b > a+1)
-                                    bOverlap = aRangeA.overlaps(aRangeB);
-                                else
-                                    bOverlap = aRangeA.overlapsMore(aRangeB);
-                                if( bOverlap)
-                                {
-                                    const bool bEdgeBIsCurve(aCubicB.isBezier());
-                                    if(bEdgeAIsCurve && bEdgeBIsCurve)
-                                    {
-                                        // test for bezier-bezier cuts
-                                        findEdgeCutsTwoBeziers(aCubicA, aCubicB, a, b, rTempPoints, rTempPoints);
-                                    }
-                                    else if(bEdgeAIsCurve)
-                                    {
-                                        // test for bezier-edge cuts
-                                        findEdgeCutsBezierAndEdge(aCubicA, aCubicB.getStartPoint(), aCubicB.getEndPoint(), a, b, rTempPoints, rTempPoints);
-                                    }
-                                    else if(bEdgeBIsCurve)
-                                    {
-                                        // test for bezier-edge cuts
-                                        findEdgeCutsBezierAndEdge(aCubicB, aCubicA.getStartPoint(), aCubicA.getEndPoint(), b, a, rTempPoints, rTempPoints);
-                                    }
-                                    else
-                                    {
-                                        // test for simple edge-edge cuts
-                                        findEdgeCutsTwoEdges(aCubicA.getStartPoint(), aCubicA.getEndPoint(), aCubicB.getStartPoint(), aCubicB.getEndPoint(),
-                                            a, b, rTempPoints, rTempPoints);
-                                    }
-                                }
+                                // test for bezier-edge cuts
+                                findEdgeCutsBezierAndEdge(aCubicA, aCubicB.getStartPoint(), aCubicB.getEndPoint(), a, b, rTempPoints, rTempPoints);
+                            }
+                            else if(bEdgeBIsCurve)
+                            {
+                                // test for bezier-edge cuts
+                                findEdgeCutsBezierAndEdge(aCubicB, aCubicA.getStartPoint(), aCubicA.getEndPoint(), b, a, rTempPoints, rTempPoints);
+                            }
+                            else
+                            {
+                                // test for simple edge-edge cuts
+                                findEdgeCutsTwoEdges(aCubicA.getStartPoint(), aCubicA.getEndPoint(), aCubicB.getStartPoint(), aCubicB.getEndPoint(),
+                                    a, b, rTempPoints, rTempPoints);
                             }
                         }
                     }
-                    else
-                    {
-                        B2DPoint aCurrA(rCandidate.getB2DPoint(0));
-
-                        for(sal_uInt32 a(0); a < nEdgeCount - 1; a++)
-                        {
-                            const B2DPoint aNextA(rCandidate.getB2DPoint(a + 1 == nPointCount ? 0 : a + 1));
-                            const B2DRange aRangeA(aCurrA, aNextA);
-                            B2DPoint aCurrB(rCandidate.getB2DPoint(a + 1));
+                }
+            }
+            else
+            {
+                B2DPoint aCurrA(rCandidate.getB2DPoint(0));
 
-                            for(sal_uInt32 b(a + 1); b < nEdgeCount; b++)
-                            {
-                                const B2DPoint aNextB(rCandidate.getB2DPoint(b + 1 == nPointCount ? 0 : b + 1));
-                                const B2DRange aRangeB(aCurrB, aNextB);
-
-                                // consecutive segments touch of course
-                                bool bOverlap = false;
-                                if( b > a+1)
-                                    bOverlap = aRangeA.overlaps(aRangeB);
-                                else
-                                    bOverlap = aRangeA.overlapsMore(aRangeB);
-                                if( bOverlap)
-                                {
-                                    findEdgeCutsTwoEdges(aCurrA, aNextA, aCurrB, aNextB, a, b, rTempPoints, rTempPoints);
-                                }
+                for(sal_uInt32 a(0); a < nEdgeCount - 1; a++)
+                {
+                    const B2DPoint aNextA(rCandidate.getB2DPoint(a + 1 == nPointCount ? 0 : a + 1));
+                    const B2DRange aRangeA(aCurrA, aNextA);
+                    B2DPoint aCurrB(rCandidate.getB2DPoint(a + 1));
 
-                                // prepare next step
-                                aCurrB = aNextB;
-                            }
+                    for(sal_uInt32 b(a + 1); b < nEdgeCount; b++)
+                    {
+                        const B2DPoint aNextB(rCandidate.getB2DPoint(b + 1 == nPointCount ? 0 : b + 1));
+                        const B2DRange aRangeB(aCurrB, aNextB);
 
-                            // prepare next step
-                            aCurrA = aNextA;
+                        // consecutive segments touch of course
+                        bool bOverlap = false;
+                        if( b > a+1)
+                            bOverlap = aRangeA.overlaps(aRangeB);
+                        else
+                            bOverlap = aRangeA.overlapsMore(aRangeB);
+                        if( bOverlap)
+                        {
+                            findEdgeCutsTwoEdges(aCurrA, aNextA, aCurrB, aNextB, a, b, rTempPoints, rTempPoints);
                         }
+
+                        // prepare next step
+                        aCurrB = aNextB;
                     }
+
+                    // prepare next step
+                    aCurrA = aNextA;
                 }
             }
         }
@@ -614,34 +614,34 @@ namespace basegfx
             // points there to represent touches (which may be enter or leave nodes later).
             const sal_uInt32 nPointCount(rPointPolygon.count());
 
-            if(nPointCount)
+            if(!nPointCount)
+                return;
+
+            const B2DRange aRange(rCurr, rNext);
+            const B2DVector aEdgeVector(rNext - rCurr);
+            bool bTestUsingX(fabs(aEdgeVector.getX()) > fabs(aEdgeVector.getY()));
+
+            for(sal_uInt32 a(0); a < nPointCount; a++)
             {
-                const B2DRange aRange(rCurr, rNext);
-                const B2DVector aEdgeVector(rNext - rCurr);
-                bool bTestUsingX(fabs(aEdgeVector.getX()) > fabs(aEdgeVector.getY()));
+                const B2DPoint aTestPoint(rPointPolygon.getB2DPoint(a));
 
-                for(sal_uInt32 a(0); a < nPointCount; a++)
+                if(aRange.isInside(aTestPoint))
                 {
-                    const B2DPoint aTestPoint(rPointPolygon.getB2DPoint(a));
-
-                    if(aRange.isInside(aTestPoint))
+                    if(!aTestPoint.equal(rCurr) && !aTestPoint.equal(rNext))
                     {
-                        if(!aTestPoint.equal(rCurr) && !aTestPoint.equal(rNext))
+                        const B2DVector aTestVector(aTestPoint - rCurr);
+
+                        if(areParallel(aEdgeVector, aTestVector))
                         {
-                            const B2DVector aTestVector(aTestPoint - rCurr);
+                            const double fCut(bTestUsingX
+                                ? aTestVector.getX() / aEdgeVector.getX()
+                                : aTestVector.getY() / aEdgeVector.getY());
+                            const double fZero(0.0);
+                            const double fOne(1.0);
 
-                            if(areParallel(aEdgeVector, aTestVector))
+                            if(fTools::more(fCut, fZero) && fTools::less(fCut, fOne))
                             {
-                                const double fCut(bTestUsingX
-                                    ? aTestVector.getX() / aEdgeVector.getX()
-                                    : aTestVector.getY() / aEdgeVector.getY());
-                                const double fZero(0.0);
-                                const double fOne(1.0);
-
-                                if(fTools::more(fCut, fZero) && fTools::less(fCut, fOne))
-                                {
-                                    rTempPoints.emplace_back(aTestPoint, nInd, fCut);
-                                }
+                                rTempPoints.emplace_back(aTestPoint, nInd, fCut);
                             }
                         }
                     }
@@ -680,43 +680,43 @@ namespace basegfx
             const sal_uInt32 nPointCount(rPointPolygon.count());
             const sal_uInt32 nEdgePointCount(rEdgePolygon.count());
 
-            if(nPointCount && nEdgePointCount)
+            if(!(nPointCount && nEdgePointCount))
+                return;
+
+            const sal_uInt32 nEdgeCount(rEdgePolygon.isClosed() ? nEdgePointCount : nEdgePointCount - 1);
+            B2DPoint aCurr(rEdgePolygon.getB2DPoint(0));
+
+            for(sal_uInt32 a(0); a < nEdgeCount; a++)
             {
-                const sal_uInt32 nEdgeCount(rEdgePolygon.isClosed() ? nEdgePointCount : nEdgePointCount - 1);
-                B2DPoint aCurr(rEdgePolygon.getB2DPoint(0));
+                const sal_uInt32 nNextIndex((a + 1) % nEdgePointCount);
+                const B2DPoint aNext(rEdgePolygon.getB2DPoint(nNextIndex));
 
-                for(sal_uInt32 a(0); a < nEdgeCount; a++)
+                if(!aCurr.equal(aNext))
                 {
-                    const sal_uInt32 nNextIndex((a + 1) % nEdgePointCount);
-                    const B2DPoint aNext(rEdgePolygon.getB2DPoint(nNextIndex));
+                    bool bHandleAsSimpleEdge(true);
 
-                    if(!aCurr.equal(aNext))
+                    if(rEdgePolygon.areControlPointsUsed())
                     {
-                        bool bHandleAsSimpleEdge(true);
-
-                        if(rEdgePolygon.areControlPointsUsed())
-                        {
-                            const B2DPoint aNextControlPoint(rEdgePolygon.getNextControlPoint(a));
-                            const B2DPoint aPrevControlPoint(rEdgePolygon.getPrevControlPoint(nNextIndex));
-                            const bool bEdgeIsCurve(!aNextControlPoint.equal(aCurr) || !aPrevControlPoint.equal(aNext));
-
-                            if(bEdgeIsCurve)
-                            {
-                                bHandleAsSimpleEdge = false;
-                                const B2DCubicBezier aCubicA(aCurr, aNextControlPoint, aPrevControlPoint, aNext);
-                                findTouchesOnCurve(aCubicA, rPointPolygon, a, rTempPoints);
-                            }
-                        }
+                        const B2DPoint aNextControlPoint(rEdgePolygon.getNextControlPoint(a));
+                        const B2DPoint aPrevControlPoint(rEdgePolygon.getPrevControlPoint(nNextIndex));
+                        const bool bEdgeIsCurve(!aNextControlPoint.equal(aCurr) || !aPrevControlPoint.equal(aNext));
 
-                        if(bHandleAsSimpleEdge)
+                        if(bEdgeIsCurve)
                         {
-                            findTouchesOnEdge(aCurr, aNext, rPointPolygon, a, rTempPoints);
+                            bHandleAsSimpleEdge = false;
+                            const B2DCubicBezier aCubicA(aCurr, aNextControlPoint, aPrevControlPoint, aNext);
+                            findTouchesOnCurve(aCubicA, rPointPolygon, a, rTempPoints);
                         }
                     }
 
-                    // next step
-                    aCurr = aNext;
+                    if(bHandleAsSimpleEdge)
+                    {
+                        findTouchesOnEdge(aCurr, aNext, rPointPolygon, a, rTempPoints);
+                    }
                 }
+
+                // next step
+                aCurr = aNext;
             }
         }
 
@@ -735,102 +735,102 @@ namespace basegfx
             const sal_uInt32 nPointCountA(rCandidateA.count());
             const sal_uInt32 nPointCountB(rCandidateB.count());
 
-            if(nPointCountA && nPointCountB)
+            if(!(nPointCountA && nPointCountB))
+                return;
+
+            const sal_uInt32 nEdgeCountA(rCandidateA.isClosed() ? nPointCountA : nPointCountA - 1);
+            const sal_uInt32 nEdgeCountB(rCandidateB.isClosed() ? nPointCountB : nPointCountB - 1);
+
+            if(!(nEdgeCountA && nEdgeCountB))
+                return;
+
+            const bool bCurvesInvolved(rCandidateA.areControlPointsUsed() || rCandidateB.areControlPointsUsed());
+
+            if(bCurvesInvolved)
             {
-                const sal_uInt32 nEdgeCountA(rCandidateA.isClosed() ? nPointCountA : nPointCountA - 1);
-                const sal_uInt32 nEdgeCountB(rCandidateB.isClosed() ? nPointCountB : nPointCountB - 1);
+                B2DCubicBezier aCubicA;
+                B2DCubicBezier aCubicB;
 
-                if(nEdgeCountA && nEdgeCountB)
+                for(sal_uInt32 a(0); a < nEdgeCountA; a++)
                 {
-                    const bool bCurvesInvolved(rCandidateA.areControlPointsUsed() || rCandidateB.areControlPointsUsed());
+                    rCandidateA.getBezierSegment(a, aCubicA);
+                    aCubicA.testAndSolveTrivialBezier();
+                    const bool bEdgeAIsCurve(aCubicA.isBezier());
+                    const B2DRange aRangeA(aCubicA.getRange());
 
-                    if(bCurvesInvolved)
+                    for(sal_uInt32 b(0); b < nEdgeCountB; b++)
                     {
-                        B2DCubicBezier aCubicA;
-                        B2DCubicBezier aCubicB;
-
-                        for(sal_uInt32 a(0); a < nEdgeCountA; a++)
+                        rCandidateB.getBezierSegment(b, aCubicB);
+                        aCubicB.testAndSolveTrivialBezier();
+                        const B2DRange aRangeB(aCubicB.getRange());
+
+                        // consecutive segments touch of course
+                        bool bOverlap = false;
+                        if( b > a+1)
+                            bOverlap = aRangeA.overlaps(aRangeB);
+                        else
+                            bOverlap = aRangeA.overlapsMore(aRangeB);
+                        if( bOverlap)
                         {
-                            rCandidateA.getBezierSegment(a, aCubicA);
-                            aCubicA.testAndSolveTrivialBezier();
-                            const bool bEdgeAIsCurve(aCubicA.isBezier());
-                            const B2DRange aRangeA(aCubicA.getRange());
-
-                            for(sal_uInt32 b(0); b < nEdgeCountB; b++)
+                            const bool bEdgeBIsCurve(aCubicB.isBezier());
+                            if(bEdgeAIsCurve && bEdgeBIsCurve)
                             {
-                                rCandidateB.getBezierSegment(b, aCubicB);
-                                aCubicB.testAndSolveTrivialBezier();
-                                const B2DRange aRangeB(aCubicB.getRange());
-
-                                // consecutive segments touch of course
-                                bool bOverlap = false;
-                                if( b > a+1)
-                                    bOverlap = aRangeA.overlaps(aRangeB);
-                                else
-                                    bOverlap = aRangeA.overlapsMore(aRangeB);
-                                if( bOverlap)
-                                {
-                                    const bool bEdgeBIsCurve(aCubicB.isBezier());
-                                    if(bEdgeAIsCurve && bEdgeBIsCurve)
-                                    {
-                                        // test for bezier-bezier cuts
-                                        findEdgeCutsTwoBeziers(aCubicA, aCubicB, a, b, rTempPointsA, rTempPointsB);
-                                    }
-                                    else if(bEdgeAIsCurve)
-                                    {
-                                        // test for bezier-edge cuts
-                                        findEdgeCutsBezierAndEdge(aCubicA, aCubicB.getStartPoint(), aCubicB.getEndPoint(), a, b, rTempPointsA, rTempPointsB);
-                                    }
-                                    else if(bEdgeBIsCurve)
-                                    {
-                                        // test for bezier-edge cuts
-                                        findEdgeCutsBezierAndEdge(aCubicB, aCubicA.getStartPoint(), aCubicA.getEndPoint(), b, a, rTempPointsB, rTempPointsA);
-                                    }
-                                    else
-                                    {
-                                        // test for simple edge-edge cuts
-                                        findEdgeCutsTwoEdges(aCubicA.getStartPoint(), aCubicA.getEndPoint(), aCubicB.getStartPoint(), aCubicB.getEndPoint(),
-                                            a, b, rTempPointsA, rTempPointsB);
-                                    }
-                                }
+                                // test for bezier-bezier cuts
+                                findEdgeCutsTwoBeziers(aCubicA, aCubicB, a, b, rTempPointsA, rTempPointsB);
+                            }
+                            else if(bEdgeAIsCurve)
+                            {
+                                // test for bezier-edge cuts
+                                findEdgeCutsBezierAndEdge(aCubicA, aCubicB.getStartPoint(), aCubicB.getEndPoint(), a, b, rTempPointsA, rTempPointsB);
+                            }
+                            else if(bEdgeBIsCurve)
+                            {
+                                // test for bezier-edge cuts
+                                findEdgeCutsBezierAndEdge(aCubicB, aCubicA.getStartPoint(), aCubicA.getEndPoint(), b, a, rTempPointsB, rTempPointsA);
+                            }
+                            else
+                            {
+                                // test for simple edge-edge cuts
+                                findEdgeCutsTwoEdges(aCubicA.getStartPoint(), aCubicA.getEndPoint(), aCubicB.getStartPoint(), aCubicB.getEndPoint(),
+                                    a, b, rTempPointsA, rTempPointsB);
                             }
                         }
                     }
-                    else
-                    {
-                        B2DPoint aCurrA(rCandidateA.getB2DPoint(0));
-
-                        for(sal_uInt32 a(0); a < nEdgeCountA; a++)
-                        {
-                            const B2DPoint aNextA(rCandidateA.getB2DPoint(a + 1 == nPointCountA ? 0 : a + 1));
-                            const B2DRange aRangeA(aCurrA, aNextA);
-                            B2DPoint aCurrB(rCandidateB.getB2DPoint(0));
+                }
+            }
+            else
+            {
+                B2DPoint aCurrA(rCandidateA.getB2DPoint(0));
 
-                            for(sal_uInt32 b(0); b < nEdgeCountB; b++)
-                            {
-                                const B2DPoint aNextB(rCandidateB.getB2DPoint(b + 1 == nPointCountB ? 0 : b + 1));
-                                const B2DRange aRangeB(aCurrB, aNextB);
-
-                                // consecutive segments touch of course
-                                bool bOverlap = false;
-                                if( b > a+1)
-                                    bOverlap = aRangeA.overlaps(aRangeB);
-                                else
-                                    bOverlap = aRangeA.overlapsMore(aRangeB);
-                                if( bOverlap)
-                                {
-                                    // test for simple edge-edge cuts
-                                    findEdgeCutsTwoEdges(aCurrA, aNextA, aCurrB, aNextB, a, b, rTempPointsA, rTempPointsB);
-                                }
+                for(sal_uInt32 a(0); a < nEdgeCountA; a++)
+                {
+                    const B2DPoint aNextA(rCandidateA.getB2DPoint(a + 1 == nPointCountA ? 0 : a + 1));
+                    const B2DRange aRangeA(aCurrA, aNextA);
+                    B2DPoint aCurrB(rCandidateB.getB2DPoint(0));
 
-                                // prepare next step
-                                aCurrB = aNextB;
-                            }
+                    for(sal_uInt32 b(0); b < nEdgeCountB; b++)
+                    {
+                        const B2DPoint aNextB(rCandidateB.getB2DPoint(b + 1 == nPointCountB ? 0 : b + 1));
+                        const B2DRange aRangeB(aCurrB, aNextB);
 
-                            // prepare next step
-                            aCurrA = aNextA;
+                        // consecutive segments touch of course
+                        bool bOverlap = false;
+                        if( b > a+1)
+                            bOverlap = aRangeA.overlaps(aRangeB);
+                        else
+                            bOverlap = aRangeA.overlapsMore(aRangeB);
+                        if( bOverlap)
+                        {
+                            // test for simple edge-edge cuts
+                            findEdgeCutsTwoEdges(aCurrA, aNextA, aCurrB, aNextB, a, b, rTempPointsA, rTempPointsB);
                         }
+
+                        // prepare next step
+                        aCurrB = aNextB;
                     }
+
+                    // prepare next step
+                    aCurrA = aNextA;
                 }
             }
         }
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx
index 1a5297e967b1..19aa7ee634b0 100644
--- a/basegfx/source/polygon/b2dpolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolygontools.cxx
@@ -43,39 +43,39 @@ namespace basegfx::utils
 {
         void openWithGeometryChange(B2DPolygon& rCandidate)
         {
-            if(rCandidate.isClosed())
+            if(!rCandidate.isClosed())
+                return;
+
+            if(rCandidate.count())
             {
-                if(rCandidate.count())
-                {
-                    rCandidate.append(rCandidate.getB2DPoint(0));
+                rCandidate.append(rCandidate.getB2DPoint(0));
 
-                    if(rCandidate.areControlPointsUsed() && rCandidate.isPrevControlPointUsed(0))
-                    {
-                        rCandidate.setPrevControlPoint(rCandidate.count() - 1, rCandidate.getPrevControlPoint(0));
-                        rCandidate.resetPrevControlPoint(0);
-                    }
+                if(rCandidate.areControlPointsUsed() && rCandidate.isPrevControlPointUsed(0))
+                {
+                    rCandidate.setPrevControlPoint(rCandidate.count() - 1, rCandidate.getPrevControlPoint(0));
+                    rCandidate.resetPrevControlPoint(0);
                 }
-
-                rCandidate.setClosed(false);
             }
+
+            rCandidate.setClosed(false);
         }
 
         void closeWithGeometryChange(B2DPolygon& rCandidate)
         {
-            if(!rCandidate.isClosed())
+            if(rCandidate.isClosed())
+                return;
+
+            while(rCandidate.count() > 1 && rCandidate.getB2DPoint(0) == rCandidate.getB2DPoint(rCandidate.count() - 1))
             {
-                while(rCandidate.count() > 1 && rCandidate.getB2DPoint(0) == rCandidate.getB2DPoint(rCandidate.count() - 1))
+                if(rCandidate.areControlPointsUsed() && rCandidate.isPrevControlPointUsed(rCandidate.count() - 1))
                 {
-                    if(rCandidate.areControlPointsUsed() && rCandidate.isPrevControlPointUsed(rCandidate.count() - 1))
-                    {
-                        rCandidate.setPrevControlPoint(0, rCandidate.getPrevControlPoint(rCandidate.count() - 1));
-                    }
-
-                    rCandidate.remove(rCandidate.count() - 1);
+                    rCandidate.setPrevControlPoint(0, rCandidate.getPrevControlPoint(rCandidate.count() - 1));
                 }
 
-                rCandidate.setClosed(true);
+                rCandidate.remove(rCandidate.count() - 1);
             }
+
+            rCandidate.setClosed(true);
         }
 
         void checkClosed(B2DPolygon& rCandidate)
@@ -2178,22 +2178,22 @@ namespace basegfx::utils
         {
             const sal_uInt32 nCount(rCandidate.count());
 
-            if(nCount > 2)
-            {
-                const B2DPoint aStart(rCandidate.getB2DPoint(0));
-                B2DPoint aLast(rCandidate.getB2DPoint(1));
+            if(nCount <= 2)
+                return;
 
-                for(sal_uInt32 a(2); a < nCount; a++)
-                {
-                    const B2DPoint aCurrent(rCandidate.getB2DPoint(a));
-                    rTarget.emplace_back(
-                        aStart,
-                        aLast,
-                        aCurrent);
+            const B2DPoint aStart(rCandidate.getB2DPoint(0));
+            B2DPoint aLast(rCandidate.getB2DPoint(1));
 
-                    // prepare next
-                    aLast = aCurrent;
-                }
+            for(sal_uInt32 a(2); a < nCount; a++)
+            {
+                const B2DPoint aCurrent(rCandidate.getB2DPoint(a));
+                rTarget.emplace_back(
+                    aStart,
+                    aLast,
+                    aCurrent);
+
+                // prepare next
+                aLast = aCurrent;
             }
         }
 
diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
index 6263c78a1ef5..e5094c7dd30d 100644
--- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx
+++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
@@ -484,32 +484,32 @@ namespace basegfx
             {
                 const sal_uInt32 nOriginalCount(rOriginal.count());
 
-                if(nOriginalCount)
-                {
-                    B2DPolygon aGeometry(utils::addPointsAtCutsAndTouches(rOriginal));
-                    aGeometry.removeDoublePoints();
-                    aGeometry = utils::simplifyCurveSegments(aGeometry);
-                    mbIsCurve = aGeometry.areControlPointsUsed();
+                if(!nOriginalCount)
+                    return;
 
-                    const sal_uInt32 nPointCount(aGeometry.count());
+                B2DPolygon aGeometry(utils::addPointsAtCutsAndTouches(rOriginal));
+                aGeometry.removeDoublePoints();
+                aGeometry = utils::simplifyCurveSegments(aGeometry);
+                mbIsCurve = aGeometry.areControlPointsUsed();
 
-                    // If it's not a bezier polygon, at least four points are needed to create
-                    // a self-intersection. If it's a bezier polygon, the minimum point number
-                    // is two, since with a single point You get a curve, but no self-intersection
-                    if(nPointCount > 3 || (nPointCount > 1 && mbIsCurve))
-                    {
-                        // reserve space in point, control and sort vector.
-                        maSNV.reserve(nPointCount);
-                        maPNV.reserve(nPointCount);
-                        maVNV.reserve(mbIsCurve ? nPointCount : 0);
+                const sal_uInt32 nPointCount(aGeometry.count());
 
-                        // fill data
-                        impAddPolygon(0, aGeometry);
+                // If it's not a bezier polygon, at least four points are needed to create
+                // a self-intersection. If it's a bezier polygon, the minimum point number
+                // is two, since with a single point You get a curve, but no self-intersection
+                if(!(nPointCount > 3 || (nPointCount > 1 && mbIsCurve)))
+                    return;
 
-                        // solve common nodes
-                        impSolve();
-                    }
-                }
+                // reserve space in point, control and sort vector.
+                maSNV.reserve(nPointCount);
+                maPNV.reserve(nPointCount);
+                maVNV.reserve(mbIsCurve ? nPointCount : 0);
+
+                // fill data
+                impAddPolygon(0, aGeometry);
+
+                // solve common nodes
+                impSolve();
             }
 
             explicit solver(const B2DPolyPolygon& rOriginal)
@@ -519,65 +519,65 @@ namespace basegfx
             {
                 sal_uInt32 nOriginalCount(maOriginal.count());
 
-                if(nOriginalCount)
-                {
-                    B2DPolyPolygon aGeometry(utils::addPointsAtCutsAndTouches(maOriginal));
-                    aGeometry.removeDoublePoints();
-                    aGeometry = utils::simplifyCurveSegments(aGeometry);
-                    mbIsCurve = aGeometry.areControlPointsUsed();
-                    nOriginalCount = aGeometry.count();
+                if(!nOriginalCount)
+                    return;
 
-                    if(nOriginalCount)
-                    {
-                        sal_uInt32 nPointCount(0);
-                        sal_uInt32 a(0);
+                B2DPolyPolygon aGeometry(utils::addPointsAtCutsAndTouches(maOriginal));
+                aGeometry.removeDoublePoints();
+                aGeometry = utils::simplifyCurveSegments(aGeometry);
+                mbIsCurve = aGeometry.areControlPointsUsed();
+                nOriginalCount = aGeometry.count();
 
-                        // count points
-                        for(a = 0; a < nOriginalCount; a++)
-                        {
-                            const B2DPolygon& aCandidate(aGeometry.getB2DPolygon(a));
-                            const sal_uInt32 nCandCount(aCandidate.count());
-
-                            // If it's not a bezier curve, at least three points would be needed to have a
-                            // topological relevant (not empty) polygon. Since it's not known here if trivial
-                            // edges (dead ends) will be kept or sorted out, add non-bezier polygons with
-                            // more than one point.
-                            // For bezier curves, the minimum for defining an area is also one.
-                            if(nCandCount)
-                            {
-                                nPointCount += nCandCount;
-                            }
-                        }
+                if(!nOriginalCount)
+                    return;
 
-                        if(nPointCount)
-                        {
-                            // reserve space in point, control and sort vector.
-                            maSNV.reserve(nPointCount);
-                            maPNV.reserve(nPointCount);
-                            maVNV.reserve(mbIsCurve ? nPointCount : 0);
+                sal_uInt32 nPointCount(0);
+                sal_uInt32 a(0);
 
-                            // fill data
-                            sal_uInt32 nInsertIndex(0);
+                // count points
+                for(a = 0; a < nOriginalCount; a++)
+                {
+                    const B2DPolygon& aCandidate(aGeometry.getB2DPolygon(a));
+                    const sal_uInt32 nCandCount(aCandidate.count());
+
+                    // If it's not a bezier curve, at least three points would be needed to have a
+                    // topological relevant (not empty) polygon. Since it's not known here if trivial
+                    // edges (dead ends) will be kept or sorted out, add non-bezier polygons with
+                    // more than one point.
+                    // For bezier curves, the minimum for defining an area is also one.
+                    if(nCandCount)
+                    {
+                        nPointCount += nCandCount;
+                    }
+                }
 
-                            for(a = 0; a < nOriginalCount; a++)
-                            {
-                                const B2DPolygon& aCandidate(aGeometry.getB2DPolygon(a));
-                                const sal_uInt32 nCandCount(aCandidate.count());
+                if(!nPointCount)
+                    return;
 
-                                // use same condition as above, the data vector is
-                                // pre-allocated
-                                if(nCandCount)
-                                {
-                                    impAddPolygon(nInsertIndex, aCandidate);
-                                    nInsertIndex += nCandCount;
-                                }
-                            }
+                // reserve space in point, control and sort vector.
+                maSNV.reserve(nPointCount);
+                maPNV.reserve(nPointCount);
+                maVNV.reserve(mbIsCurve ? nPointCount : 0);
 
-                            // solve common nodes
-                            impSolve();
-                        }
+                // fill data
+                sal_uInt32 nInsertIndex(0);
+
+                for(a = 0; a < nOriginalCount; a++)
+                {
+                    const B2DPolygon& aCandidate(aGeometry.getB2DPolygon(a));
+                    const sal_uInt32 nCandCount(aCandidate.count());
+
+                    // use same condition as above, the data vector is
+                    // pre-allocated
+                    if(nCandCount)
+                    {
+                        impAddPolygon(nInsertIndex, aCandidate);
+                        nInsertIndex += nCandCount;
                     }
                 }
+
+                // solve common nodes
+                impSolve();
             }
 
             B2DPolyPolygon getB2DPolyPolygon()
diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx
index 75b6d38a19df..b763aef823c2 100644
--- a/basegfx/source/polygon/b2dpolypolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolypolygontools.cxx
@@ -215,23 +215,23 @@ namespace basegfx::utils
                 fFullDashDotLen = std::accumulate(rDotDashArray.begin(), rDotDashArray.end(), 0.0);
             }
 
-            if(rCandidate.count() && fFullDashDotLen > 0.0)
+            if(!(rCandidate.count() && fFullDashDotLen > 0.0))
+                return;
+
+            B2DPolyPolygon aLineTarget;
+
+            for(auto const& rPolygon : rCandidate)
             {
-                B2DPolyPolygon aLineTarget;
+                applyLineDashing(
+                    rPolygon,
+                    rDotDashArray,
+                    pLineTarget ? &aLineTarget : nullptr,
+                    nullptr,
+                    fFullDashDotLen);
 
-                for(auto const& rPolygon : rCandidate)
+                if(pLineTarget)
                 {
-                    applyLineDashing(
-                        rPolygon,
-                        rDotDashArray,
-                        pLineTarget ? &aLineTarget : nullptr,
-                        nullptr,
-                        fFullDashDotLen);
-
-                    if(pLineTarget)
-                    {
-                        pLineTarget->append(aLineTarget);
-                    }
+                    pLineTarget->append(aLineTarget);
                 }
             }
         }
diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx
index 36c0c483a291..5648aa3be81c 100644
--- a/basegfx/source/polygon/b2dtrapezoid.cxx
+++ b/basegfx/source/polygon/b2dtrapezoid.cxx
@@ -422,61 +422,61 @@ namespace basegfx::trapezoidhelper
 
             void solveHorizontalEdges(TrDeSimpleEdges& rTrDeSimpleEdges)
             {
-                if(!rTrDeSimpleEdges.empty() && !maTrDeEdgeEntries.empty())
+                if(rTrDeSimpleEdges.empty() || maTrDeEdgeEntries.empty())
+                    return;
+
+                // there were horizontal edges. These can be excluded, but
+                // cuts with other edges need to be solved and added before
+                // ignoring them
+                for(const TrDeSimpleEdge & rHorEdge : rTrDeSimpleEdges)
                 {
-                    // there were horizontal edges. These can be excluded, but
-                    // cuts with other edges need to be solved and added before
-                    // ignoring them
-                    for(const TrDeSimpleEdge & rHorEdge : rTrDeSimpleEdges)
-                    {
-                        // get horizontal edge as candidate; prepare its range and fixed Y
-                        const B1DRange aRange(rHorEdge.getStart().getX(), rHorEdge.getEnd().getX());
-                        const double fFixedY(rHorEdge.getStart().getY());
+                    // get horizontal edge as candidate; prepare its range and fixed Y
+                    const B1DRange aRange(rHorEdge.getStart().getX(), rHorEdge.getEnd().getX());
+                    const double fFixedY(rHorEdge.getStart().getY());
+
+                    // loop over traversing edges
+                    TrDeEdgeEntries::iterator aCurrent(maTrDeEdgeEntries.begin());
 
-                        // loop over traversing edges
-                        TrDeEdgeEntries::iterator aCurrent(maTrDeEdgeEntries.begin());
+                    do
+                    {
+                        // get compare edge
+                        TrDeEdgeEntries::reference aCompare(*aCurrent++);
 
-                        do
+                        if(fTools::lessOrEqual(aCompare.getEnd().getY(), fFixedY))
                         {
-                            // get compare edge
-                            TrDeEdgeEntries::reference aCompare(*aCurrent++);
+                            // edge ends above horizontal edge, continue
+                            continue;
+                        }
 
-                            if(fTools::lessOrEqual(aCompare.getEnd().getY(), fFixedY))
-                            {
-                                // edge ends above horizontal edge, continue
-                                continue;
-                            }
+                        if(fTools::moreOrEqual(aCompare.getStart().getY(), fFixedY))
+                        {
+                            // edge starts below horizontal edge, continue
+                            continue;
+                        }
 
-                            if(fTools::moreOrEqual(aCompare.getStart().getY(), fFixedY))
-                            {
-                                // edge starts below horizontal edge, continue
-                                continue;
-                            }
+                        // vertical overlap, get horizontal range
+                        const B1DRange aCompareRange(aCompare.getStart().getX(), aCompare.getEnd().getX());
 
-                            // vertical overlap, get horizontal range
-                            const B1DRange aCompareRange(aCompare.getStart().getX(), aCompare.getEnd().getX());
+                        if(aRange.overlaps(aCompareRange))
+                        {
+                            // possible cut, get cut point
+                            const B2DPoint aSplit(aCompare.getCutPointForGivenY(fFixedY));
 
-                            if(aRange.overlaps(aCompareRange))
+                            if(fTools::more(aSplit.getX(), aRange.getMinimum())
+                                && fTools::less(aSplit.getX(), aRange.getMaximum()))
                             {
-                                // possible cut, get cut point
-                                const B2DPoint aSplit(aCompare.getCutPointForGivenY(fFixedY));
+                                // cut is in XRange of horizontal edge, potentially needed cut
+                                B2DPoint* pNewPoint = maNewPoints.allocatePoint(aSplit);
 
-                                if(fTools::more(aSplit.getX(), aRange.getMinimum())
-                                    && fTools::less(aSplit.getX(), aRange.getMaximum()))
+                                if(!splitEdgeAtGivenPoint(aCompare, *pNewPoint, aCurrent))
                                 {
-                                    // cut is in XRange of horizontal edge, potentially needed cut
-                                    B2DPoint* pNewPoint = maNewPoints.allocatePoint(aSplit);
-
-                                    if(!splitEdgeAtGivenPoint(aCompare, *pNewPoint, aCurrent))
-                                    {
-                                        maNewPoints.freeIfLast(pNewPoint);
-                                    }
+                                    maNewPoints.freeIfLast(pNewPoint);
                                 }
                             }
                         }
-                        while(aCurrent != maTrDeEdgeEntries.end()
-                            && fTools::less(aCurrent->getStart().getY(), fFixedY));
                     }
+                    while(aCurrent != maTrDeEdgeEntries.end()
+                        && fTools::less(aCurrent->getStart().getY(), fFixedY));
                 }
             }
 
diff --git a/basegfx/source/polygon/b3dpolygon.cxx b/basegfx/source/polygon/b3dpolygon.cxx
index 422353fba8ad..e3aa78d9bf3f 100644
--- a/basegfx/source/polygon/b3dpolygon.cxx
+++ b/basegfx/source/polygon/b3dpolygon.cxx
@@ -210,18 +210,18 @@ public:
 
     void flip()
     {
-        if(maVector.size() > 1)
-        {
-            const sal_uInt32 nHalfSize(maVector.size() >> 1);
-            CoordinateData3DVector::iterator aStart(maVector.begin());
-            CoordinateData3DVector::iterator aEnd(maVector.end() - 1);
+        if(maVector.size() <= 1)
+            return;
 
-            for(sal_uInt32 a(0); a < nHalfSize; a++)
-            {
-                std::swap(*aStart, *aEnd);
-                ++aStart;
-                --aEnd;
-            }
+        const sal_uInt32 nHalfSize(maVector.size() >> 1);
+        CoordinateData3DVector::iterator aStart(maVector.begin());
+        CoordinateData3DVector::iterator aEnd(maVector.end() - 1);
+
+        for(sal_uInt32 a(0); a < nHalfSize; a++)
+        {
+            std::swap(*aStart, *aEnd);
+            ++aStart;
+            --aEnd;
         }
     }
 
@@ -360,18 +360,18 @@ public:
 
     void flip()
     {
-        if(maVector.size() > 1)
-        {
-            const sal_uInt32 nHalfSize(maVector.size() >> 1);
-            BColorDataVector::iterator aStart(maVector.begin());
-            BColorDataVector::iterator aEnd(maVector.end() - 1);
+        if(maVector.size() <= 1)
+            return;
 
-            for(sal_uInt32 a(0); a < nHalfSize; a++)
-            {
-                std::swap(*aStart, *aEnd);
-                ++aStart;
-                --aEnd;
-            }
+        const sal_uInt32 nHalfSize(maVector.size() >> 1);
+        BColorDataVector::iterator aStart(maVector.begin());
+        BColorDataVector::iterator aEnd(maVector.end() - 1);
+
+        for(sal_uInt32 a(0); a < nHalfSize; a++)
+        {
+            std::swap(*aStart, *aEnd);
+            ++aStart;
+            --aEnd;
         }
     }
 };
@@ -501,18 +501,18 @@ public:
 
     void flip()
     {
-        if(maVector.size() > 1)
-        {
-            const sal_uInt32 nHalfSize(maVector.size() >> 1);
-            NormalsData3DVector::iterator aStart(maVector.begin());
-            NormalsData3DVector::iterator aEnd(maVector.end() - 1);
+        if(maVector.size() <= 1)
+            return;
 
-            for(sal_uInt32 a(0); a < nHalfSize; a++)
-            {
-                std::swap(*aStart, *aEnd);
-                ++aStart;
-                --aEnd;
-            }
+        const sal_uInt32 nHalfSize(maVector.size() >> 1);
+        NormalsData3DVector::iterator aStart(maVector.begin());
+        NormalsData3DVector::iterator aEnd(maVector.end() - 1);
+
+        for(sal_uInt32 a(0); a < nHalfSize; a++)
+        {
+            std::swap(*aStart, *aEnd);
+            ++aStart;
+            --aEnd;
         }
     }
 
@@ -650,18 +650,18 @@ public:
 
     void flip()
     {
-        if(maVector.size() > 1)
-        {
-            const sal_uInt32 nHalfSize(maVector.size() >> 1);
-            TextureData2DVector::iterator aStart(maVector.begin());
-            TextureData2DVector::iterator aEnd(maVector.end() - 1);
+        if(maVector.size() <= 1)
+            return;
 
-            for(sal_uInt32 a(0); a < nHalfSize; a++)
-            {
-                std::swap(*aStart, *aEnd);
-                ++aStart;
-                --aEnd;
-            }
+        const sal_uInt32 nHalfSize(maVector.size() >> 1);
+        TextureData2DVector::iterator aStart(maVector.begin());
+        TextureData2DVector::iterator aEnd(maVector.end() - 1);
+
+        for(sal_uInt32 a(0); a < nHalfSize; a++)
+        {
+            std::swap(*aStart, *aEnd);
+            ++aStart;
+            --aEnd;
         }
     }
 
@@ -922,26 +922,26 @@ public:
 
     void insert(sal_uInt32 nIndex, const ::basegfx::B3DPoint& rPoint, sal_uInt32 nCount)
     {
-        if(nCount)
-        {
-            CoordinateData3D aCoordinate(rPoint);
-            maPoints.insert(nIndex, aCoordinate, nCount);
-            invalidatePlaneNormal();
+        if(!nCount)
+            return;
 
-            if(mpBColors)
-            {
-                mpBColors->insert(nIndex, ::basegfx::BColor::getEmptyBColor(), nCount);
-            }
+        CoordinateData3D aCoordinate(rPoint);
+        maPoints.insert(nIndex, aCoordinate, nCount);
+        invalidatePlaneNormal();
 
-            if(mpNormals)
-            {
-                mpNormals->insert(nIndex, ::basegfx::B3DVector::getEmptyVector(), nCount);
-            }
+        if(mpBColors)
+        {
+            mpBColors->insert(nIndex, ::basegfx::BColor::getEmptyBColor(), nCount);
+        }
 
-            if(mpTextureCoordinates)
-            {
-                mpTextureCoordinates->insert(nIndex, ::basegfx::B2DPoint::getEmptyPoint(), nCount);
-            }
+        if(mpNormals)
+        {
+            mpNormals->insert(nIndex, ::basegfx::B3DVector::getEmptyVector(), nCount);
+        }
+
+        if(mpTextureCoordinates)
+        {
+            mpTextureCoordinates->insert(nIndex, ::basegfx::B2DPoint::getEmptyPoint(), nCount);
         }
     }
 
@@ -1105,129 +1105,129 @@ public:
     {
         const sal_uInt32 nCount(rSource.maPoints.count());
 
-        if(nCount)
-        {
-            maPoints.insert(nIndex, rSource.maPoints);
-            invalidatePlaneNormal();
+        if(!nCount)
+            return;
 
-            if(rSource.mpBColors && rSource.mpBColors->isUsed())
-            {
-                if(!mpBColors)
-                {
-                    mpBColors.reset( new BColorArray(maPoints.count()) );
-                }
+        maPoints.insert(nIndex, rSource.maPoints);
+        invalidatePlaneNormal();
 
-                mpBColors->insert(nIndex, *rSource.mpBColors);
-            }
-            else
+        if(rSource.mpBColors && rSource.mpBColors->isUsed())
+        {
+            if(!mpBColors)
             {
-                if(mpBColors)
-                {
-                    mpBColors->insert(nIndex, ::basegfx::BColor::getEmptyBColor(), nCount);
-                }
+                mpBColors.reset( new BColorArray(maPoints.count()) );
             }
 
-            if(rSource.mpNormals && rSource.mpNormals->isUsed())
+            mpBColors->insert(nIndex, *rSource.mpBColors);
+        }
+        else
+        {
+            if(mpBColors)
             {
-                if(!mpNormals)
-                {
-                    mpNormals.reset( new NormalsArray3D(maPoints.count()) );
-                }
-
-                mpNormals->insert(nIndex, *rSource.mpNormals);
+                mpBColors->insert(nIndex, ::basegfx::BColor::getEmptyBColor(), nCount);
             }
-            else
+        }
+
+        if(rSource.mpNormals && rSource.mpNormals->isUsed())
+        {
+            if(!mpNormals)
             {
-                if(mpNormals)
-                {
-                    mpNormals->insert(nIndex, ::basegfx::B3DVector::getEmptyVector(), nCount);
-                }
+                mpNormals.reset( new NormalsArray3D(maPoints.count()) );
             }
 
-            if(rSource.mpTextureCoordinates && rSource.mpTextureCoordinates->isUsed())
+            mpNormals->insert(nIndex, *rSource.mpNormals);
+        }
+        else
+        {
+            if(mpNormals)
             {
-                if(!mpTextureCoordinates)
-                {
-                    mpTextureCoordinates.reset( new TextureCoordinate2D(maPoints.count()) );
-                }
+                mpNormals->insert(nIndex, ::basegfx::B3DVector::getEmptyVector(), nCount);
+            }
+        }
 
-                mpTextureCoordinates->insert(nIndex, *rSource.mpTextureCoordinates);
+        if(rSource.mpTextureCoordinates && rSource.mpTextureCoordinates->isUsed())
+        {
+            if(!mpTextureCoordinates)
+            {
+                mpTextureCoordinates.reset( new TextureCoordinate2D(maPoints.count()) );
             }
-            else
+
+            mpTextureCoordinates->insert(nIndex, *rSource.mpTextureCoordinates);
+        }
+        else
+        {
+            if(mpTextureCoordinates)
             {
-                if(mpTextureCoordinates)
-                {
-                    mpTextureCoordinates->insert(nIndex, ::basegfx::B2DPoint::getEmptyPoint(), nCount);
-                }
+                mpTextureCoordinates->insert(nIndex, ::basegfx::B2DPoint::getEmptyPoint(), nCount);
             }
         }
     }
 
     void remove(sal_uInt32 nIndex, sal_uInt32 nCount)
     {
-        if(nCount)
+        if(!nCount)
+            return;
+
+        maPoints.remove(nIndex, nCount);
+        invalidatePlaneNormal();
+
+        if(mpBColors)
         {
-            maPoints.remove(nIndex, nCount);
-            invalidatePlaneNormal();

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list