summaryrefslogtreecommitdiff
path: root/basegfx
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2023-09-28 09:04:26 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-09-28 13:24:58 +0200
commit984dfa1f478db52c2adf8e77a15687b6fecc176b (patch)
tree98f951455edecc20c75a5fca3dcf7e10c433260d /basegfx
parent3a871a0a2c5d6d5d3fd4091072903a389c27b277 (diff)
cid#1545233 sidestep COPY_INSTEAD_OF_MOVE
Change-Id: I93b8225b7ae2fdb4ea5fc371ce278f00d3dec33f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157356 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'basegfx')
-rw-r--r--basegfx/source/polygon/b2dpolygontools.cxx58
-rw-r--r--basegfx/source/polygon/b3dpolygontools.cxx17
2 files changed, 34 insertions, 41 deletions
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx
index 56b286403671..b3f43669ddf4 100644
--- a/basegfx/source/polygon/b2dpolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolygontools.cxx
@@ -1232,8 +1232,8 @@ namespace basegfx::utils
void applyLineDashing(
const B2DPolygon& rCandidate,
const std::vector<double>& rDotDashArray,
- std::function<void(const basegfx::B2DPolygon& rSnippet)> aLineTargetCallback,
- std::function<void(const basegfx::B2DPolygon& rSnippet)> aGapTargetCallback,
+ const std::function<void(const basegfx::B2DPolygon& rSnippet)>& rLineTargetCallback,
+ const std::function<void(const basegfx::B2DPolygon& rSnippet)>& rGapTargetCallback,
double fDotDashLength)
{
const sal_uInt32 nPointCount(rCandidate.count());
@@ -1244,18 +1244,14 @@ namespace basegfx::utils
fDotDashLength = std::accumulate(rDotDashArray.begin(), rDotDashArray.end(), 0.0);
}
- if(fTools::lessOrEqual(fDotDashLength, 0.0) || (!aLineTargetCallback && !aGapTargetCallback) || !nPointCount)
+ if(fTools::lessOrEqual(fDotDashLength, 0.0) || (!rLineTargetCallback && !rGapTargetCallback) || !nPointCount)
{
// parameters make no sense, just add source to targets
- if(aLineTargetCallback)
- {
- aLineTargetCallback(rCandidate);
- }
+ if (rLineTargetCallback)
+ rLineTargetCallback(rCandidate);
- if(aGapTargetCallback)
- {
- aGapTargetCallback(rCandidate);
- }
+ if (rGapTargetCallback)
+ rGapTargetCallback(rCandidate);
return;
}
@@ -1326,8 +1322,8 @@ namespace basegfx::utils
while(fTools::less(fDotDashMovingLength, fEdgeLength))
{
// new split is inside edge, create and append snippet [fLastDotDashMovingLength, fDotDashMovingLength]
- const bool bHandleLine(bIsLine && aLineTargetCallback);
- const bool bHandleGap(!bIsLine && aGapTargetCallback);
+ const bool bHandleLine(bIsLine && rLineTargetCallback);
+ const bool bHandleGap(!bIsLine && rGapTargetCallback);
if(bHandleLine || bHandleGap)
{
@@ -1344,12 +1340,12 @@ namespace basegfx::utils
if(bHandleLine)
{
- implHandleSnippet(aSnippet, aLineTargetCallback, aFirstLine, aLastLine);
+ implHandleSnippet(aSnippet, rLineTargetCallback, aFirstLine, aLastLine);
}
if(bHandleGap)
{
- implHandleSnippet(aSnippet, aGapTargetCallback, aFirstGap, aLastGap);
+ implHandleSnippet(aSnippet, rGapTargetCallback, aFirstGap, aLastGap);
}
aSnippet.clear();
@@ -1362,8 +1358,8 @@ namespace basegfx::utils
}
// append closing snippet [fLastDotDashMovingLength, fEdgeLength]
- const bool bHandleLine(bIsLine && aLineTargetCallback);
- const bool bHandleGap(!bIsLine && aGapTargetCallback);
+ const bool bHandleLine(bIsLine && rLineTargetCallback);
+ const bool bHandleGap(!bIsLine && rGapTargetCallback);
if(bHandleLine || bHandleGap)
{
@@ -1394,8 +1390,8 @@ namespace basegfx::utils
while(fTools::less(fDotDashMovingLength, fEdgeLength))
{
// new split is inside edge, create and append snippet [fLastDotDashMovingLength, fDotDashMovingLength]
- const bool bHandleLine(bIsLine && aLineTargetCallback);
- const bool bHandleGap(!bIsLine && aGapTargetCallback);
+ const bool bHandleLine(bIsLine && rLineTargetCallback);
+ const bool bHandleGap(!bIsLine && rGapTargetCallback);
if(bHandleLine || bHandleGap)
{
@@ -1408,12 +1404,12 @@ namespace basegfx::utils
if(bHandleLine)
{
- implHandleSnippet(aSnippet, aLineTargetCallback, aFirstLine, aLastLine);
+ implHandleSnippet(aSnippet, rLineTargetCallback, aFirstLine, aLastLine);
}
if(bHandleGap)
{
- implHandleSnippet(aSnippet, aGapTargetCallback, aFirstGap, aLastGap);
+ implHandleSnippet(aSnippet, rGapTargetCallback, aFirstGap, aLastGap);
}
aSnippet.clear();
@@ -1426,8 +1422,8 @@ namespace basegfx::utils
}
// append snippet [fLastDotDashMovingLength, fEdgeLength]
- const bool bHandleLine(bIsLine && aLineTargetCallback);
- const bool bHandleGap(!bIsLine && aGapTargetCallback);
+ const bool bHandleLine(bIsLine && rLineTargetCallback);
+ const bool bHandleGap(!bIsLine && rGapTargetCallback);
if(bHandleLine || bHandleGap)
{
@@ -1451,28 +1447,28 @@ namespace basegfx::utils
// append last intermediate results (if exists)
if(aSnippet.count())
{
- const bool bHandleLine(bIsLine && aLineTargetCallback);
- const bool bHandleGap(!bIsLine && aGapTargetCallback);
+ const bool bHandleLine(bIsLine && rLineTargetCallback);
+ const bool bHandleGap(!bIsLine && rGapTargetCallback);
if(bHandleLine)
{
- implHandleSnippet(aSnippet, aLineTargetCallback, aFirstLine, aLastLine);
+ implHandleSnippet(aSnippet, rLineTargetCallback, aFirstLine, aLastLine);
}
if(bHandleGap)
{
- implHandleSnippet(aSnippet, aGapTargetCallback, aFirstGap, aLastGap);
+ implHandleSnippet(aSnippet, rGapTargetCallback, aFirstGap, aLastGap);
}
}
- if(bIsClosed && aLineTargetCallback)
+ if(bIsClosed && rLineTargetCallback)
{
- implHandleFirstLast(aLineTargetCallback, aFirstLine, aLastLine);
+ implHandleFirstLast(rLineTargetCallback, aFirstLine, aLastLine);
}
- if(bIsClosed && aGapTargetCallback)
+ if(bIsClosed && rGapTargetCallback)
{
- implHandleFirstLast(aGapTargetCallback, aFirstGap, aLastGap);
+ implHandleFirstLast(rGapTargetCallback, aFirstGap, aLastGap);
}
}
diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx
index 3b3779d7460a..7c92f5ddcea5 100644
--- a/basegfx/source/polygon/b3dpolygontools.cxx
+++ b/basegfx/source/polygon/b3dpolygontools.cxx
@@ -173,7 +173,7 @@ 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());
@@ -184,14 +184,11 @@ namespace basegfx::utils
fDotDashLength = std::accumulate(rDotDashArray.begin(), rDotDashArray.end(), 0.0);
}
- if(fTools::lessOrEqual(fDotDashLength, 0.0) || !aLineTargetCallback || !nPointCount)
+ if(fTools::lessOrEqual(fDotDashLength, 0.0) || !rLineTargetCallback || !nPointCount)
{
// parameters make no sense, just add source to targets
- if(aLineTargetCallback)
- {
- aLineTargetCallback(rCandidate);
- }
-
+ if (rLineTargetCallback)
+ rLineTargetCallback(rCandidate);
return;
}
@@ -259,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();
}
@@ -294,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);
}
}