Small optimizations.

This commit is contained in:
Alex 2022-09-22 20:04:17 +03:00 committed by Mike Williams
parent 897135a4f0
commit 58b03b0a1c
8 changed files with 35 additions and 30 deletions

View File

@ -180,7 +180,7 @@ KIFONT::FONT* LIB_PIN::GetDrawFont() const
wxString LIB_PIN::GetShownName() const
{
if( m_name == "~" )
if( m_name == wxS( "~" ) )
return wxEmptyString;
else
return m_name;

View File

@ -206,11 +206,11 @@ wxString SCH_FIELD::GetShownText( int aDepth ) const
wxString text = EDA_TEXT::GetShownText();
if( IsNameShown() )
text = GetName() << wxT( ": " ) << text;
text = GetName() << wxS( ": " ) << text;
if( text == "~" ) // Legacy placeholder for empty string
if( text == wxS( "~" ) ) // Legacy placeholder for empty string
{
text = "";
text = wxS( "" );
}
else if( HasTextVars() )
{

View File

@ -557,9 +557,9 @@ wxString SCH_LABEL_BASE::GetShownText( int aDepth ) const
wxString text = EDA_TEXT::GetShownText();
if( text == "~" ) // Legacy placeholder for empty string
if( text == wxS( "~" ) ) // Legacy placeholder for empty string
{
text = "";
text = wxS( "" );
}
else if( HasTextVars() )
{

View File

@ -98,7 +98,7 @@ wxString SCH_PIN::GetShownName() const
if( !m_alt.IsEmpty() )
name = m_alt;
if( name == "~" )
if( name == wxS( "~" ) )
return wxEmptyString;
else
return name;
@ -107,7 +107,7 @@ wxString SCH_PIN::GetShownName() const
wxString SCH_PIN::GetShownNumber() const
{
if( m_number == "~" )
if( m_number == wxS( "~" ) )
return wxEmptyString;
else
return m_number;

View File

@ -297,25 +297,26 @@ KIID_PATH SCH_SHEET_PATH::PathWithoutRootUuid() const
wxString SCH_SHEET_PATH::PathHumanReadable( bool aUseShortRootName ) const
{
wxString s;
wxString fileName;
if( !empty() && at( 0 )->GetScreen() )
fileName = at( 0 )->GetScreen()->GetFileName();
if( aUseShortRootName )
{
s = wxT( "/" ); // Use only the short name in netlists
s = wxS( "/" ); // Use only the short name in netlists
}
else
{
wxString fileName;
if( !empty() && at( 0 )->GetScreen() )
fileName = at( 0 )->GetScreen()->GetFileName();
wxFileName fn = fileName;
s = fn.GetName() + wxT( "/" );
s = fn.GetName() + wxS( "/" );
}
// Start at 1 since we've already processed the root sheet.
for( unsigned i = 1; i < size(); i++ )
s << at( i )->GetFields()[SHEETNAME].GetShownText() << wxT( "/" );
s << at( i )->GetFields()[SHEETNAME].GetShownText() << wxS( "/" );
return s;
}

View File

@ -364,9 +364,9 @@ wxString SCH_TEXT::GetShownText( int aDepth ) const
wxString text = EDA_TEXT::GetShownText();
if( text == "~" ) // Legacy placeholder for empty string
if( text == wxS( "~" ) ) // Legacy placeholder for empty string
{
text = "";
text = wxS( "" );
}
else if( HasTextVars() )
{

View File

@ -109,7 +109,10 @@ ClipperLib::Path SHAPE_LINE_CHAIN::convertToClipper( bool aRequiredOrientation,
else
input = *this;
for( int i = 0; i < input.PointCount(); i++ )
int pointCount = input.PointCount();
c_path.reserve( pointCount );
for( int i = 0; i < pointCount; i++ )
{
const VECTOR2I& vertex = input.CPoint( i );

View File

@ -1360,23 +1360,11 @@ double PAD::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
PCB_PAINTER* painter = static_cast<PCB_PAINTER*>( aView->GetPainter() );
PCB_RENDER_SETTINGS* renderSettings = painter->GetSettings();
const BOARD* board = GetBoard();
LSET visible = LSET::AllLayersMask();
// Meta control for hiding all pads
if( !aView->IsLayerVisible( LAYER_PADS ) )
return HIDE;
// Handle board visibility
if( board )
visible &= board->GetEnabledLayers();
// Handle view visibility
for( int layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
{
if( !aView->IsLayerVisible( layer ) )
visible.set( layer, false );
}
// Handle Render tab switches
if( ( GetAttribute() == PAD_ATTRIB::PTH || GetAttribute() == PAD_ATTRIB::NPTH )
&& !aView->IsLayerVisible( LAYER_PADS_TH ) )
@ -1396,6 +1384,19 @@ double PAD::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
if( IsBackLayer( (PCB_LAYER_ID) aLayer ) && !aView->IsLayerVisible( LAYER_PAD_BK ) )
return HIDE;
LSET visible = LSET::AllLayersMask();
// Handle board visibility
if( board )
visible &= board->GetEnabledLayers();
// Handle view visibility
for( int layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
{
if( !aView->IsLayerVisible( layer ) )
visible.set( layer, false );
}
if( aLayer == LAYER_PADS_TH )
{
if( !FlashLayer( visible ) )