diff options
Diffstat (limited to 'basegfx/source/polygon/b3dpolygontools.cxx')
-rw-r--r-- | basegfx/source/polygon/b3dpolygontools.cxx | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx index a1f65bef2f48..968624e0f28b 100644 --- a/basegfx/source/polygon/b3dpolygontools.cxx +++ b/basegfx/source/polygon/b3dpolygontools.cxx @@ -173,25 +173,22 @@ namespace basegfx::utils void applyLineDashing( const B3DPolygon& rCandidate, const std::vector<double>& rDotDashArray, - std::function<void(const basegfx::B3DPolygon& rSnippet)> aLineTargetCallback, + const std::function<void(const basegfx::B3DPolygon& rSnippet)>& rLineTargetCallback, double fDotDashLength) { const sal_uInt32 nPointCount(rCandidate.count()); const sal_uInt32 nDotDashCount(rDotDashArray.size()); - if(fTools::lessOrEqual(fDotDashLength, 0.0)) + if(fDotDashLength <= 0.0) { fDotDashLength = std::accumulate(rDotDashArray.begin(), rDotDashArray.end(), 0.0); } - if(fTools::lessOrEqual(fDotDashLength, 0.0) || !aLineTargetCallback || !nPointCount) + if(fDotDashLength <= 0.0 || !rLineTargetCallback || !nPointCount) { // parameters make no sense, just add source to targets - if(aLineTargetCallback) - { - aLineTargetCallback(rCandidate); - } - + if (rLineTargetCallback) + rLineTargetCallback(rCandidate); return; } @@ -219,7 +216,6 @@ namespace basegfx::utils // to enlarge these as needed const double fFactor(fCandidateLength / fAllowedLength); std::for_each(aDotDashArray.begin(), aDotDashArray.end(), [&fFactor](double &f){ f *= fFactor; }); - fDotDashLength *= fFactor; } // prepare current edge's start @@ -260,7 +256,7 @@ namespace basegfx::utils aSnippet.append(interpolate(aCurrentPoint, aNextPoint, fDotDashMovingLength / fEdgeLength)); - implHandleSnippet(aSnippet, aLineTargetCallback, aFirstLine, aLastLine); + implHandleSnippet(aSnippet, rLineTargetCallback, aFirstLine, aLastLine); aSnippet.clear(); } @@ -295,13 +291,13 @@ namespace basegfx::utils { if(bIsLine) { - implHandleSnippet(aSnippet, aLineTargetCallback, aFirstLine, aLastLine); + implHandleSnippet(aSnippet, rLineTargetCallback, aFirstLine, aLastLine); } } if(bIsClosed) { - implHandleFirstLast(aLineTargetCallback, aFirstLine, aLastLine); + implHandleFirstLast(rLineTargetCallback, aFirstLine, aLastLine); } } |