Move early exit higher in netname redraw

If the track is outside of the viewbox, GetLOD returns HIDE.  This needs
to be handled quickly in the loop before further processing

Fixes https://gitlab.com/kicad/code/kicad/issues/13572
This commit is contained in:
Seth Hillbrand 2023-01-17 15:36:02 -08:00
parent 3cc960a872
commit f35a02d57a
1 changed files with 6 additions and 7 deletions

View File

@ -532,20 +532,19 @@ void PCB_EDIT_FRAME::redrawNetnames( wxTimerEvent& aEvent )
return; return;
KIGFX::VIEW* view = GetCanvas()->GetView(); KIGFX::VIEW* view = GetCanvas()->GetView();
double scale = view->GetScale();
for( PCB_TRACK* track : GetBoard()->Tracks() ) for( PCB_TRACK* track : GetBoard()->Tracks() )
{ {
double lod = track->ViewGetLOD( GetNetnameLayer( track->GetLayer() ), view ); double lod = track->ViewGetLOD( GetNetnameLayer( track->GetLayer() ), view );
double scale = view->GetScale();
if( lod < scale )
continue;
if( lod != track->GetCachedLOD() || scale != track->GetCachedScale() ) if( lod != track->GetCachedLOD() || scale != track->GetCachedScale() )
{ {
if( lod < view->GetScale() ) view->Update( track, KIGFX::REPAINT );
{ needs_refresh = true;
view->Update( track, KIGFX::REPAINT );
needs_refresh = true;
}
track->SetCachedLOD( lod ); track->SetCachedLOD( lod );
track->SetCachedScale( scale ); track->SetCachedScale( scale );
} }