Reduce scope of some view repaints to improve performance
This commit is contained in:
parent
4482b3baba
commit
2cbd7b5043
|
@ -175,7 +175,13 @@ public:
|
|||
* (for instance solid or sketch mode).
|
||||
*/
|
||||
const PCB_DISPLAY_OPTIONS& GetDisplayOptions() const { return m_displayOptions; }
|
||||
void SetDisplayOptions( const PCB_DISPLAY_OPTIONS& aOptions );
|
||||
|
||||
/**
|
||||
* Updates the current display options from the given options struct
|
||||
* @param aOptions is the options struct to apply
|
||||
* @param aRefresh will refresh the view after updating
|
||||
*/
|
||||
void SetDisplayOptions( const PCB_DISPLAY_OPTIONS& aOptions, bool aRefresh = true );
|
||||
|
||||
const ZONE_SETTINGS& GetZoneSettings() const;
|
||||
void SetZoneSettings( const ZONE_SETTINGS& aSettings );
|
||||
|
|
|
@ -117,9 +117,23 @@ bool PANEL_DISPLAY_OPTIONS::TransferDataFromWindow()
|
|||
crossProbing.center_on_items = m_checkCrossProbeCenter->GetValue();
|
||||
crossProbing.zoom_to_fit = m_checkCrossProbeZoom->GetValue();
|
||||
crossProbing.auto_highlight = m_checkCrossProbeAutoHighlight->GetValue();
|
||||
|
||||
// Mark items with clearance display for repaint
|
||||
view->UpdateAllItemsConditionally( KIGFX::REPAINT,
|
||||
[]( KIGFX::VIEW_ITEM* aItem ) -> bool
|
||||
{
|
||||
if( EDA_ITEM* item = dynamic_cast<EDA_ITEM*>( aItem ) )
|
||||
{
|
||||
return( item->Type() == PCB_TRACE_T ||
|
||||
item->Type() == PCB_ARC_T ||
|
||||
item->Type() == PCB_VIA_T ||
|
||||
item->Type() == PCB_PAD_T );
|
||||
}
|
||||
|
||||
return false;
|
||||
} );
|
||||
}
|
||||
|
||||
view->RecacheAllItems();
|
||||
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
|
||||
|
||||
return true;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <pcb_painter.h>
|
||||
#include <pcb_view.h>
|
||||
#include <pcbnew_settings.h>
|
||||
#include <ratsnest/ratsnest_view_item.h>
|
||||
#include <widgets/paged_dialog.h>
|
||||
#include <footprint_edit_frame.h>
|
||||
|
||||
|
@ -140,9 +141,14 @@ bool PANEL_EDIT_OPTIONS::TransferDataFromWindow()
|
|||
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
|
||||
KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
|
||||
|
||||
m_frame->SetDisplayOptions( displ_opts );
|
||||
m_frame->SetDisplayOptions( displ_opts, false );
|
||||
settings->LoadDisplayOptions( displ_opts, m_frame->ShowPageLimits() );
|
||||
view->RecacheAllItems();
|
||||
|
||||
view->UpdateAllItemsConditionally( KIGFX::REPAINT,
|
||||
[]( KIGFX::VIEW_ITEM* aItem ) -> bool
|
||||
{
|
||||
return dynamic_cast<RATSNEST_VIEW_ITEM*>( aItem );
|
||||
} );
|
||||
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
|
||||
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
|
|
|
@ -674,7 +674,7 @@ void PCB_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars
|
|||
EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
|
||||
|
||||
GetCanvas()->GetView()->GetPainter()->GetSettings()->LoadColors( GetColorSettings() );
|
||||
GetCanvas()->GetView()->UpdateAllItems( KIGFX::ALL );
|
||||
GetCanvas()->GetView()->UpdateAllItems( KIGFX::COLOR );
|
||||
|
||||
RecreateToolbars();
|
||||
|
||||
|
@ -732,7 +732,7 @@ void PCB_BASE_FRAME::ActivateGalCanvas()
|
|||
}
|
||||
|
||||
|
||||
void PCB_BASE_FRAME::SetDisplayOptions( const PCB_DISPLAY_OPTIONS& aOptions )
|
||||
void PCB_BASE_FRAME::SetDisplayOptions( const PCB_DISPLAY_OPTIONS& aOptions, bool aRefresh )
|
||||
{
|
||||
bool hcChanged = m_displayOptions.m_ContrastModeDisplay != aOptions.m_ContrastModeDisplay;
|
||||
m_displayOptions = aOptions;
|
||||
|
@ -760,5 +760,6 @@ void PCB_BASE_FRAME::SetDisplayOptions( const PCB_DISPLAY_OPTIONS& aOptions )
|
|||
} );
|
||||
}
|
||||
|
||||
if( aRefresh )
|
||||
canvas->Refresh();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue