diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-31 15:43:39 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-01 07:13:23 +0100 |
commit | 094542511fae905106a9daa19c049ff669e61bdc (patch) | |
tree | f94a7da351d61b04df92cc42ad855d3e0cb91371 /basegfx | |
parent | 1a284d1f98069f55d5211882431f516691c2a6f0 (diff) |
loplugin:constantparam in basegfx
Change-Id: Ieabdd6f8d76cfc2ed75f2ec618def6591a9adc93
Reviewed-on: https://gerrit.libreoffice.org/44130
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/source/curve/b2dcubicbezier.cxx | 9 | ||||
-rw-r--r-- | basegfx/source/inc/stringconversiontools.hxx | 10 | ||||
-rw-r--r-- | basegfx/source/polygon/b2dpolypolygontools.cxx | 21 | ||||
-rw-r--r-- | basegfx/source/polygon/b3dpolygontools.cxx | 56 | ||||
-rw-r--r-- | basegfx/source/polygon/b3dpolypolygontools.cxx | 14 | ||||
-rw-r--r-- | basegfx/source/tools/stringconversiontools.cxx | 2 |
6 files changed, 28 insertions, 84 deletions
diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx index 446d976b1c02..3f4a100ae2e1 100644 --- a/basegfx/source/curve/b2dcubicbezier.cxx +++ b/basegfx/source/curve/b2dcubicbezier.cxx @@ -113,8 +113,7 @@ namespace basegfx const B2DPoint& rfEB, // edge on B const B2DPoint& rfPB, // end point B2DPolygon& rTarget, // target polygon - const double& rfAngleBound, // angle bound in [0.0 .. 2PI] - bool bAllowUnsharpen) // #i37443# allow the criteria to get unsharp in recursions + const double& rfAngleBound) // angle bound in [0.0 .. 2PI] { sal_uInt16 nMaxRecursionDepth(8); const B2DVector aLeft(rfEA - rfPA); @@ -231,7 +230,7 @@ namespace basegfx } else { - ImpSubDivAngle(rfPA, aS1L, aS2L, aS3C, rTarget, rfAngleBound, bAllowUnsharpen, nMaxRecursionDepth); + ImpSubDivAngle(rfPA, aS1L, aS2L, aS3C, rTarget, rfAngleBound, true/*bAllowUnsharpen*/, nMaxRecursionDepth); } // right @@ -241,7 +240,7 @@ namespace basegfx } else { - ImpSubDivAngle(aS3C, aS2R, aS1R, rfPB, rTarget, rfAngleBound, bAllowUnsharpen, nMaxRecursionDepth); + ImpSubDivAngle(aS3C, aS2R, aS1R, rfPB, rTarget, rfAngleBound, true/*bAllowUnsharpen*/, nMaxRecursionDepth); } } } @@ -551,7 +550,7 @@ namespace basegfx if(isBezier()) { // use support method #i37443# and allow unsharpen the criteria - ImpSubDivAngleStart(maStartPoint, maControlPointA, maControlPointB, maEndPoint, rTarget, fAngleBound * F_PI180, true/*bAllowUnsharpen*/); + ImpSubDivAngleStart(maStartPoint, maControlPointA, maControlPointB, maEndPoint, rTarget, fAngleBound * F_PI180); } else { diff --git a/basegfx/source/inc/stringconversiontools.hxx b/basegfx/source/inc/stringconversiontools.hxx index b49804849855..f2ccb1ac3324 100644 --- a/basegfx/source/inc/stringconversiontools.hxx +++ b/basegfx/source/inc/stringconversiontools.hxx @@ -36,22 +36,20 @@ namespace basegfx const sal_Int32 nLen); inline bool isOnNumberChar(const sal_Unicode aChar, - bool bSignAllowed, - bool bDotAllowed) + bool bSignAllowed) { const bool bPredicate( (u'0' <= aChar && u'9' >= aChar) || (bSignAllowed && u'+' == aChar) || (bSignAllowed && u'-' == aChar) - || (bDotAllowed && u'.' == aChar)); + || (u'.' == aChar)); return bPredicate; } inline bool isOnNumberChar(const OUString& rStr, - const sal_Int32 nPos, - bool bSignAllowed = true) + const sal_Int32 nPos) { - return isOnNumberChar(rStr[nPos], bSignAllowed, true); + return isOnNumberChar(rStr[nPos], true/*bSignAllowed*/); } bool getDoubleChar(double& o_fRetval, diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx index 6e0a62f18a89..644e08bb6358 100644 --- a/basegfx/source/polygon/b2dpolypolygontools.cxx +++ b/basegfx/source/polygon/b2dpolypolygontools.cxx @@ -231,7 +231,7 @@ namespace basegfx return fabs(getSignedArea(rCandidate)); } - void applyLineDashing(const B2DPolyPolygon& rCandidate, const std::vector<double>& rDotDashArray, B2DPolyPolygon* pLineTarget, B2DPolyPolygon* pGapTarget, double fFullDashDotLen) + void applyLineDashing(const B2DPolyPolygon& rCandidate, const std::vector<double>& rDotDashArray, B2DPolyPolygon* pLineTarget, double fFullDashDotLen) { if(fFullDashDotLen == 0.0 && rDotDashArray.size()) { @@ -241,7 +241,7 @@ namespace basegfx if(rCandidate.count() && fFullDashDotLen > 0.0) { - B2DPolyPolygon aLineTarget, aGapTarget; + B2DPolyPolygon aLineTarget; for(sal_uInt32 a(0); a < rCandidate.count(); a++) { @@ -251,18 +251,13 @@ namespace basegfx aCandidate, rDotDashArray, pLineTarget ? &aLineTarget : nullptr, - pGapTarget ? &aGapTarget : nullptr, + nullptr, fFullDashDotLen); if(pLineTarget) { pLineTarget->append(aLineTarget); } - - if(pGapTarget) - { - pGapTarget->append(aGapTarget); - } } } } @@ -596,8 +591,7 @@ namespace basegfx // converters for css::drawing::PointSequence B2DPolyPolygon UnoPointSequenceSequenceToB2DPolyPolygon( - const css::drawing::PointSequenceSequence& rPointSequenceSequenceSource, - bool bCheckClosed) + const css::drawing::PointSequenceSequence& rPointSequenceSequenceSource) { B2DPolyPolygon aRetval; const css::drawing::PointSequence* pPointSequence = rPointSequenceSequenceSource.getConstArray(); @@ -605,7 +599,7 @@ namespace basegfx for(;pPointSequence != pPointSeqEnd; pPointSequence++) { - const B2DPolygon aNewPolygon = UnoPointSequenceToB2DPolygon(*pPointSequence, bCheckClosed); + const B2DPolygon aNewPolygon = UnoPointSequenceToB2DPolygon(*pPointSequence, true/*bCheckClosed*/); aRetval.append(aNewPolygon); } @@ -640,8 +634,7 @@ namespace basegfx // converters for css::drawing::PolyPolygonBezierCoords (curved polygons) B2DPolyPolygon UnoPolyPolygonBezierCoordsToB2DPolyPolygon( - const css::drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoordsSource, - bool bCheckClosed) + const css::drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoordsSource) { B2DPolyPolygon aRetval; const sal_uInt32 nSequenceCount((sal_uInt32)rPolyPolygonBezierCoordsSource.Coordinates.getLength()); @@ -658,7 +651,7 @@ namespace basegfx const B2DPolygon aNewPolygon(UnoPolygonBezierCoordsToB2DPolygon( *pPointSequence, *pFlagSequence, - bCheckClosed)); + true/*bCheckClosed*/)); pPointSequence++; pFlagSequence++; diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx index de362287f8ea..17dd77600f96 100644 --- a/basegfx/source/polygon/b3dpolygontools.cxx +++ b/basegfx/source/polygon/b3dpolygontools.cxx @@ -94,7 +94,7 @@ namespace basegfx return fRetval; } - void applyLineDashing(const B3DPolygon& rCandidate, const std::vector<double>& rDotDashArray, B3DPolyPolygon* pLineTarget, B3DPolyPolygon* pGapTarget, double fDotDashLength) + void applyLineDashing(const B3DPolygon& rCandidate, const std::vector<double>& rDotDashArray, B3DPolyPolygon* pLineTarget, double fDotDashLength) { const sal_uInt32 nPointCount(rCandidate.count()); const sal_uInt32 nDotDashCount(rDotDashArray.size()); @@ -104,7 +104,7 @@ namespace basegfx fDotDashLength = std::accumulate(rDotDashArray.begin(), rDotDashArray.end(), 0.0); } - if(fTools::more(fDotDashLength, 0.0) && (pLineTarget || pGapTarget) && nPointCount) + if(fTools::more(fDotDashLength, 0.0) && pLineTarget && nPointCount) { // clear targets if(pLineTarget) @@ -112,11 +112,6 @@ namespace basegfx pLineTarget->clear(); } - if(pGapTarget) - { - pGapTarget->clear(); - } - // prepare current edge's start B3DPoint aCurrentPoint(rCandidate.getB3DPoint(0)); const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nPointCount : nPointCount - 1); @@ -142,9 +137,8 @@ namespace basegfx { // new split is inside edge, create and append snippet [fLastDotDashMovingLength, fDotDashMovingLength] const bool bHandleLine(bIsLine && pLineTarget); - const bool bHandleGap(!bIsLine && pGapTarget); - if(bHandleLine || bHandleGap) + if(bHandleLine) { if(!aSnippet.count()) { @@ -157,10 +151,6 @@ namespace basegfx { pLineTarget->append(aSnippet); } - else - { - pGapTarget->append(aSnippet); - } aSnippet.clear(); } @@ -173,9 +163,8 @@ namespace basegfx // append snippet [fLastDotDashMovingLength, fEdgeLength] const bool bHandleLine(bIsLine && pLineTarget); - const bool bHandleGap(!bIsLine && pGapTarget); - if(bHandleLine || bHandleGap) + if(bHandleLine) { if(!aSnippet.count()) { @@ -200,10 +189,6 @@ namespace basegfx { pLineTarget->append(aSnippet); } - else if(!bIsLine && pGapTarget) - { - pGapTarget->append(aSnippet); - } } // check if start and end polygon may be merged @@ -228,28 +213,6 @@ namespace basegfx } } } - - if(pGapTarget) - { - const sal_uInt32 nCount(pGapTarget->count()); - - if(nCount > 1) - { - // these polygons were created above, there exists none with less than two points, - // thus dircet point access below is allowed - const B3DPolygon aFirst(pGapTarget->getB3DPolygon(0)); - B3DPolygon aLast(pGapTarget->getB3DPolygon(nCount - 1)); - - if(aFirst.getB3DPoint(0).equal(aLast.getB3DPoint(aLast.count() - 1))) - { - // start of first and end of last are the same -> merge them - aLast.append(aFirst); - aLast.removeDoublePoints(); - pGapTarget->setB3DPolygon(0, aLast); - pGapTarget->remove(nCount - 1); - } - } - } } else { @@ -258,11 +221,6 @@ namespace basegfx { pLineTarget->append(rCandidate); } - - if(pGapTarget) - { - pGapTarget->append(rCandidate); - } } } @@ -676,7 +634,7 @@ namespace basegfx } } - bool isPointOnPolygon(const B3DPolygon& rCandidate, const B3DPoint& rPoint, bool bWithPoints) + bool isPointOnPolygon(const B3DPolygon& rCandidate, const B3DPoint& rPoint) { const sal_uInt32 nPointCount(rCandidate.count()); @@ -689,7 +647,7 @@ namespace basegfx { const B3DPoint aNextPoint(rCandidate.getB3DPoint((a + 1) % nPointCount)); - if(isPointOnLine(aCurrentPoint, aNextPoint, rPoint, bWithPoints)) + if(isPointOnLine(aCurrentPoint, aNextPoint, rPoint, true/*bWithPoints*/)) { return true; } @@ -697,7 +655,7 @@ namespace basegfx aCurrentPoint = aNextPoint; } } - else if(nPointCount && bWithPoints) + else if(nPointCount) { return rPoint.equal(rCandidate.getB3DPoint(0)); } diff --git a/basegfx/source/polygon/b3dpolypolygontools.cxx b/basegfx/source/polygon/b3dpolypolygontools.cxx index ba93d1926b84..d3ae28120e29 100644 --- a/basegfx/source/polygon/b3dpolypolygontools.cxx +++ b/basegfx/source/polygon/b3dpolypolygontools.cxx @@ -455,13 +455,13 @@ namespace basegfx return aRetval; } - bool isInside(const B3DPolyPolygon& rCandidate, const B3DPoint& rPoint, bool bWithBorder) + bool isInside(const B3DPolyPolygon& rCandidate, const B3DPoint& rPoint) { const sal_uInt32 nPolygonCount(rCandidate.count()); if(nPolygonCount == 1) { - return isInside(rCandidate.getB3DPolygon(0), rPoint, bWithBorder); + return isInside(rCandidate.getB3DPolygon(0), rPoint, false/*bWithBorder*/); } else { @@ -470,7 +470,7 @@ namespace basegfx for(sal_uInt32 a(0); a < nPolygonCount; a++) { const B3DPolygon aPolygon(rCandidate.getB3DPolygon(a)); - const bool bInside(isInside(aPolygon, rPoint, bWithBorder)); + const bool bInside(isInside(aPolygon, rPoint, false/*bWithBorder*/)); if(bInside) { @@ -484,8 +484,7 @@ namespace basegfx /// converters for css::drawing::PolyPolygonShape3D B3DPolyPolygon UnoPolyPolygonShape3DToB3DPolyPolygon( - const css::drawing::PolyPolygonShape3D& rPolyPolygonShape3DSource, - bool bCheckClosed) + const css::drawing::PolyPolygonShape3D& rPolyPolygonShape3DSource) { B3DPolyPolygon aRetval; const sal_Int32 nOuterSequenceCount(rPolyPolygonShape3DSource.SequenceX.getLength()); @@ -523,10 +522,7 @@ namespace basegfx // #i101520# correction is needed for imported polygons of old format, // see callers - if(bCheckClosed) - { - basegfx::utils::checkClosed(aNewPolygon); - } + basegfx::utils::checkClosed(aNewPolygon); aRetval.append(aNewPolygon); } diff --git a/basegfx/source/tools/stringconversiontools.cxx b/basegfx/source/tools/stringconversiontools.cxx index 569d7d0c50f2..c657d4687bcf 100644 --- a/basegfx/source/tools/stringconversiontools.cxx +++ b/basegfx/source/tools/stringconversiontools.cxx @@ -170,7 +170,7 @@ namespace basegfx const sal_Int32 aLen( rStr.getLength() ); if(aLen) { - if( isOnNumberChar(rStr[aLen - 1], false, true) && + if( isOnNumberChar(rStr[aLen - 1], false) && fValue >= 0.0 ) { rStr.append( ' ' ); |