From 0400b4fc7230fcc5f7d3f6b88944ed0186c34ae3 Mon Sep 17 00:00:00 2001 From: Yann Lossouarn Date: Fri, 23 Feb 2024 18:42:43 +0100 Subject: [PATCH] Code smell and performance : capture various variables by reference --- src/libs/vdxf/vdxfengine.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libs/vdxf/vdxfengine.cpp b/src/libs/vdxf/vdxfengine.cpp index 41c9179ab..2fd71fa29 100644 --- a/src/libs/vdxf/vdxfengine.cpp +++ b/src/libs/vdxf/vdxfengine.cpp @@ -912,7 +912,7 @@ void VDxfEngine::ExportAAMADrawSewLine(const QSharedPointer &deta const UTF8STRING &layer = not detail.IsSewLineOnDrawing() ? *layer14 : *layer8; QVector const points = detail.GetMappedFullContourPoints(); - auto DrawPolygon = [this, detailBlock, layer](const QVector &points, bool forceClosed) + auto DrawPolygon = [this, detailBlock, &layer](const QVector &points, bool forceClosed) { if (DRW_Entity *e = AAMAPolygon(points, layer, forceClosed)) { @@ -977,7 +977,7 @@ void VDxfEngine::ExportAAMADrawInternalPaths(const QSharedPointer { const QTransform matrix = VGObject::FlippingMatrix(detail.GetMappedSeamMirrorLine()); std::transform(points.begin(), points.end(), points.begin(), - [matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); }); + [&matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); }); DrawPolygon(points, iPath.PenStyle(), false); } } @@ -1015,7 +1015,7 @@ void VDxfEngine::ExportAAMADrawPlaceLabels(const QSharedPointer & for (auto &points : shape) { std::transform(points.begin(), points.end(), points.begin(), - [matrix](const VLayoutPoint &point) + [&matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); }); } @@ -1049,7 +1049,7 @@ void VDxfEngine::ExportAAMAIntcut(const QSharedPointer &detailBlo { const QTransform matrix = VGObject::FlippingMatrix(detail.GetMappedSeamMirrorLine()); std::transform(points.begin(), points.end(), points.begin(), - [matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); }); + [&matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); }); DrawPolygon(points, false); } } @@ -1524,7 +1524,7 @@ void VDxfEngine::ExportASTMDrawInternalPaths(const QSharedPointer { const QTransform matrix = VGObject::FlippingMatrix(detail.GetMappedSeamMirrorLine()); std::transform(points.begin(), points.end(), points.begin(), - [matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); }); + [&matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); }); DrawPolygon(points, iPath.PenStyle(), iPath.IsNotMirrored(), false); } } @@ -1576,7 +1576,7 @@ void VDxfEngine::ExportASTMDrawPlaceLabels(const QSharedPointer & for (auto &points : shape) { std::transform(points.begin(), points.end(), points.begin(), - [matrix](const VLayoutPoint &point) + [&matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); }); } @@ -1624,7 +1624,7 @@ void VDxfEngine::ExportASTMInternalCutout(const QSharedPointer &d { const QTransform matrix = VGObject::FlippingMatrix(detail.GetMappedSeamMirrorLine()); std::transform(points.begin(), points.end(), points.begin(), - [matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); }); + [&matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); }); DrawPolygon(points, intCut.IsNotMirrored(), false); } } @@ -1687,7 +1687,7 @@ void VDxfEngine::ExportASTMNotches(const QSharedPointer &detailBl return; } - auto ExportPassmark = [this, detailBlock, detail](const VLayoutPassmark &passmark) + auto ExportPassmark = [this, detailBlock, &detail](const VLayoutPassmark &passmark) { DRW_ASTMNotch *notch = ExportASTMNotch(passmark); DRW_ATTDEF *attdef = ExportASTMNotchDataDependecy(passmark, notch->layer, detail);