mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-19 18:31:40 +00:00
Avoid copies when using auto
This commit is contained in:
parent
906c2f3d49
commit
c0622eaa45
3d-viewer/3d_canvas
common/widgets
include/http_lib
pcbnew
@ -639,8 +639,9 @@ std::map<int, COLOR4D> BOARD_ADAPTER::GetLayerColors() const
|
||||
const BOARD_STACKUP& stackup = m_board->GetDesignSettings().GetStackupDescriptor();
|
||||
KIGFX::COLOR4D bodyColor( 0, 0, 0, 0 );
|
||||
|
||||
// Can't do a const KIGFX::COLOR4D& return type here because there are temporary variables
|
||||
auto findColor =
|
||||
[]( const wxString& aColorName, const CUSTOM_COLORS_LIST& aColorSet )
|
||||
[]( const wxString& aColorName, const CUSTOM_COLORS_LIST& aColorSet ) -> const KIGFX::COLOR4D
|
||||
{
|
||||
if( aColorName.StartsWith( wxT( "#" ) ) )
|
||||
{
|
||||
|
@ -215,7 +215,7 @@ void LISTBOX_TRICKS::OnListBoxRDown( wxMouseEvent& aEvent )
|
||||
{
|
||||
wxMenu menu;
|
||||
|
||||
const auto mstr = [&]( const MENU_ID& id )
|
||||
const auto mstr = [&]( const MENU_ID& id ) -> const wxString&
|
||||
{
|
||||
return m_menuStrings[id];
|
||||
};
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
return m_categoryDescriptions.at( aCategoryName );
|
||||
}
|
||||
|
||||
auto getCachedParts() { return m_cache; }
|
||||
auto& getCachedParts() { return m_cache; }
|
||||
|
||||
private:
|
||||
// This is clunky but at the moment the only way to free the pointer after use without KiCad crashing.
|
||||
|
@ -131,8 +131,9 @@ EXPORTER_PCB_VRML::EXPORTER_PCB_VRML( BOARD* aBoard ) :
|
||||
|
||||
const BOARD_STACKUP& stackup = m_board->GetDesignSettings().GetStackupDescriptor();
|
||||
|
||||
// Can't do a const KIGFX::COLOR4D& return type here because there are temporary variables
|
||||
auto findColor =
|
||||
[]( const wxString& aColorName, const CUSTOM_COLORS_LIST& aColorSet )
|
||||
[]( const wxString& aColorName, const CUSTOM_COLORS_LIST& aColorSet ) -> const KIGFX::COLOR4D
|
||||
{
|
||||
if( aColorName.StartsWith( wxT( "#" ) ) )
|
||||
{
|
||||
|
@ -2282,8 +2282,8 @@ int DRAWING_TOOL::PlaceTuningPattern( const TOOL_EVENT& aEvent )
|
||||
|
||||
auto applyCommonSettings = [&]( PCB_TUNING_PATTERN* aPattern )
|
||||
{
|
||||
auto origTargetLength = aPattern->GetSettings().m_targetLength;
|
||||
auto origTargetSkew = aPattern->GetSettings().m_targetSkew;
|
||||
const auto& origTargetLength = aPattern->GetSettings().m_targetLength;
|
||||
const auto& origTargetSkew = aPattern->GetSettings().m_targetSkew;
|
||||
|
||||
aPattern->GetSettings() = meanderSettings;
|
||||
|
||||
|
@ -184,7 +184,7 @@ bool MULTI_DRAGGER::Start( const VECTOR2I& aP, ITEM_SET& aPrimitives )
|
||||
bestSeg = &l;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( bestCorner && bestSeg )
|
||||
{
|
||||
if( minCornerDist < minLeadSegDist )
|
||||
@ -296,7 +296,7 @@ bool clipToOtherLine( NODE* aNode, const LINE& aRef, LINE& aClipped )
|
||||
VECTOR2I pclip = sl_tmp.PointAlong( curL );
|
||||
int idx = sl_tmp.Split( pclip );
|
||||
sl_tmp = sl_tmp.Slice(0, idx);
|
||||
|
||||
|
||||
l.SetShape( sl_tmp );
|
||||
|
||||
//PNS_DBG( dbg, 3int, pclip, WHITE, 500000, wxT(""));
|
||||
@ -545,7 +545,7 @@ bool MULTI_DRAGGER::multidragMarkObstacles( std::vector<MDRAG_LINE>& aCompletedL
|
||||
m_lastNode = nullptr;
|
||||
}
|
||||
|
||||
// m_lastNode contains the temporary (post-modification) state. Think of it as
|
||||
// m_lastNode contains the temporary (post-modification) state. Think of it as
|
||||
// of an efficient undo buffer. We don't change the PCB directly, but a branch of it
|
||||
// created below. We can then commit its state (applying the modifications to the host board
|
||||
// by calling ROUTING::CommitRouting(m_lastNode) or simply discard it.
|
||||
@ -557,8 +557,8 @@ bool MULTI_DRAGGER::multidragMarkObstacles( std::vector<MDRAG_LINE>& aCompletedL
|
||||
{
|
||||
for( int l2 = l1 + 1; l2 < aCompletedLines.size(); l2++ )
|
||||
{
|
||||
auto l1l = aCompletedLines[l1].draggedLine;
|
||||
auto l2l = aCompletedLines[l2].draggedLine;
|
||||
const auto& l1l = aCompletedLines[l1].draggedLine;
|
||||
auto l2l = aCompletedLines[l2].draggedLine;
|
||||
|
||||
if( clipToOtherLine( m_lastNode, l1l, l2l ) )
|
||||
{
|
||||
@ -601,8 +601,8 @@ bool MULTI_DRAGGER::multidragShove( std::vector<MDRAG_LINE>& aCompletedLines )
|
||||
|
||||
for( auto& l : m_mdragLines )
|
||||
{
|
||||
PNS_DBG( Dbg(), Message, wxString::Format ( wxT("net %-30s: isCorner %d isStrict %d c-Dist %-10d l-dist %-10d leadIndex %-2d CisLast %d dragDist %-10d"),
|
||||
iface->GetNetName( l.draggedLine.Net() ),
|
||||
PNS_DBG( Dbg(), Message, wxString::Format ( wxT("net %-30s: isCorner %d isStrict %d c-Dist %-10d l-dist %-10d leadIndex %-2d CisLast %d dragDist %-10d"),
|
||||
iface->GetNetName( l.draggedLine.Net() ),
|
||||
(int) l.isCorner?1:0,
|
||||
(int) l.isStrict?1:0,
|
||||
(int) l.cornerDistance,
|
||||
@ -612,7 +612,7 @@ bool MULTI_DRAGGER::multidragShove( std::vector<MDRAG_LINE>& aCompletedLines )
|
||||
(int) l.dragDist ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
m_shove->SetDefaultShovePolicy( SHOVE::SHP_SHOVE );
|
||||
m_shove->ClearHeads();
|
||||
|
||||
@ -859,7 +859,7 @@ bool MULTI_DRAGGER::Drag( const VECTOR2I& aP )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (l.isPrimaryLine)
|
||||
{
|
||||
l.draggedLine = *primaryDragged;
|
||||
|
Loading…
Reference in New Issue
Block a user