From f35a02d57a482063ec1285246aeea941e34599be Mon Sep 17 00:00:00 2001 From: Seth Hillbrand <seth@kipro-pcb.com> Date: Tue, 17 Jan 2023 15:36:02 -0800 Subject: [PATCH] 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 --- pcbnew/pcb_edit_frame.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 93783f6c4e..682bd57143 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -532,20 +532,19 @@ void PCB_EDIT_FRAME::redrawNetnames( wxTimerEvent& aEvent ) return; KIGFX::VIEW* view = GetCanvas()->GetView(); + double scale = view->GetScale(); for( PCB_TRACK* track : GetBoard()->Tracks() ) { 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 < view->GetScale() ) - { - view->Update( track, KIGFX::REPAINT ); - needs_refresh = true; - } - + view->Update( track, KIGFX::REPAINT ); + needs_refresh = true; track->SetCachedLOD( lod ); track->SetCachedScale( scale ); }