Fixed layers caching settings. Added some comments.
This commit is contained in:
parent
e050133c07
commit
62ea71fcae
|
@ -212,6 +212,7 @@ TOOL_ID TOOL_MANAGER::MakeToolId( const std::string& aToolName )
|
|||
return currentId++;
|
||||
}
|
||||
|
||||
|
||||
void TOOL_MANAGER::SetEnvironment( EDA_ITEM* aModel, KiGfx::VIEW* aView,
|
||||
KiGfx::VIEW_CONTROLS* aViewControls, wxWindow* aFrame )
|
||||
{
|
||||
|
|
|
@ -544,7 +544,8 @@ void VIEW::redrawRect( const BOX2I& aRect )
|
|||
}
|
||||
}
|
||||
|
||||
bool VIEW::IsDirty()
|
||||
|
||||
bool VIEW::IsDirty() const
|
||||
{
|
||||
BOOST_FOREACH( VIEW_LAYER* l, m_orderedLayers )
|
||||
{
|
||||
|
@ -554,6 +555,7 @@ bool VIEW::IsDirty()
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
struct VIEW::unlinkItem
|
||||
{
|
||||
void operator()( VIEW_ITEM* aItem )
|
||||
|
@ -644,28 +646,32 @@ void VIEW::invalidateItem( VIEW_ITEM* aItem, int aUpdateFlags )
|
|||
|
||||
for( int i = 0; i < layer_count; i++ )
|
||||
{
|
||||
if(m_layers.find(layer_indices[i]) != m_layers.end())
|
||||
// Iterate through the layers used by the item
|
||||
if( m_layers.find( layer_indices[i] ) != m_layers.end() )
|
||||
{
|
||||
VIEW_LAYER* l = &m_layers[layer_indices[i]];
|
||||
|
||||
// Mark the area occupied by the item as dirty
|
||||
l->dirtyExtents =
|
||||
l->isDirty ? aItem->ViewBBox() : l->dirtyExtents.Merge( aItem->ViewBBox() );
|
||||
|
||||
l->isDirty = true;
|
||||
|
||||
// If geometry has to be updated, then we need to reinsert the item
|
||||
if( aUpdateFlags & VIEW_ITEM::GEOMETRY )
|
||||
{
|
||||
l->items->Remove( aItem );
|
||||
l->items->Insert( aItem ); /* reinsert */
|
||||
aItem->deleteGroups();
|
||||
l->items->Insert( aItem );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all the groups, so the item will be recached
|
||||
if( aItem->storesGroups() )
|
||||
{
|
||||
// Clear the cached groups stored in GAL
|
||||
std::vector<int> groups = aItem->getAllGroups();
|
||||
for(std::vector<int>::iterator i = groups.begin(); i != groups.end(); i++ )
|
||||
for( std::vector<int>::iterator i = groups.begin(); i != groups.end(); i++ )
|
||||
{
|
||||
m_gal->DeleteGroup( *i );
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ void VIEW_ITEM::ViewSetVisible( bool aIsVisible )
|
|||
|
||||
void VIEW_ITEM::ViewUpdate( int aUpdateFlags, bool aForceImmediateRedraw )
|
||||
{
|
||||
if(!m_view)
|
||||
if( !m_view )
|
||||
return;
|
||||
|
||||
m_view->invalidateItem( this, aUpdateFlags );
|
||||
|
@ -124,11 +124,8 @@ void VIEW_ITEM::setGroup( int aLayer, int aId )
|
|||
|
||||
void VIEW_ITEM::deleteGroups()
|
||||
{
|
||||
if( m_groupsSize > 0 )
|
||||
{
|
||||
delete[] m_groups;
|
||||
m_groupsSize = 0;
|
||||
}
|
||||
delete[] m_groups;
|
||||
m_groupsSize = 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -99,8 +99,7 @@ protected:
|
|||
///< using GAL
|
||||
KiGfx::WX_VIEW_CONTROLS* m_viewControls; ///< Control for VIEW (moving, zooming, etc.)
|
||||
GalType m_currentGal; ///< Currently used GAL
|
||||
wxLongLong m_timeStamp;
|
||||
TOOL_DISPATCHER* m_eventDispatcher;
|
||||
TOOL_DISPATCHER* m_eventDispatcher;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -371,7 +371,12 @@ public:
|
|||
*/
|
||||
bool IsDynamic() const { return m_dynamic; }
|
||||
|
||||
bool IsDirty();
|
||||
/**
|
||||
* Function IsDirty()
|
||||
* Returns true if any of the VIEW layers needs to be refreshened.
|
||||
* @return True in case if any of layers is marked as dirty.
|
||||
*/
|
||||
bool IsDirty() const;
|
||||
|
||||
static const int VIEW_MAX_LAYERS = 128; ///* maximum number of layers that may be shown
|
||||
|
||||
|
|
|
@ -178,6 +178,9 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
|
|||
// Load module's texts (name and value)
|
||||
view->Add( &module->Reference() );
|
||||
view->Add( &module->Value() );
|
||||
|
||||
// Add the module itself
|
||||
view->Add( module );
|
||||
}
|
||||
|
||||
// Segzones (equivalent of ZONE_CONTAINER for legacy boards)
|
||||
|
@ -191,8 +194,8 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
|
|||
m_galCanvas->Refresh();
|
||||
|
||||
// update the tool manager with the new board and its view.
|
||||
if(m_toolManager)
|
||||
m_toolManager->SetEnvironment( m_Pcb, view, m_galCanvas->GetViewControls(), this);
|
||||
if( m_toolManager )
|
||||
m_toolManager->SetEnvironment( m_Pcb, view, m_galCanvas->GetViewControls(), this );
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -799,31 +802,33 @@ void PCB_BASE_FRAME::LoadSettings()
|
|||
|
||||
// Apply display settings for GAL
|
||||
KiGfx::VIEW* view = m_galCanvas->GetView();
|
||||
// Set rendering order of layers
|
||||
for( LAYER_NUM i = 0; i < sizeof(GalLayerOrder) / sizeof(LAYER_NUM); ++i )
|
||||
|
||||
// Set rendering order and properties of layers
|
||||
for( LAYER_NUM i = 0; (unsigned) i < sizeof(GalLayerOrder) / sizeof(LAYER_NUM); ++i )
|
||||
{
|
||||
wxASSERT( i < KiGfx::VIEW::VIEW_MAX_LAYERS );
|
||||
LAYER_NUM layer = GalLayerOrder[i];
|
||||
wxASSERT( layer < KiGfx::VIEW::VIEW_MAX_LAYERS );
|
||||
|
||||
view->SetLayerOrder( GalLayerOrder[i], i );
|
||||
view->SetLayerTarget( i, KiGfx::TARGET_NONCACHED );
|
||||
view->SetLayerOrder( layer, i );
|
||||
|
||||
if( IsCopperLayer( i ) )
|
||||
if( IsCopperLayer( layer ) )
|
||||
{
|
||||
// Copper layers are required for netname layers
|
||||
view->SetRequired( GetNetnameLayer( i ), i );
|
||||
view->SetRequired( GetNetnameLayer( layer ), layer );
|
||||
view->SetLayerTarget( layer, KiGfx::TARGET_CACHED );
|
||||
}
|
||||
else
|
||||
if( IsNetnameLayer( i ) )
|
||||
else if( IsNetnameLayer( layer ) )
|
||||
{
|
||||
// Netnames are drawn only when scale is sufficient (level of details)
|
||||
// so there is no point in caching them
|
||||
view->SetLayerTarget( i, KiGfx::TARGET_NONCACHED );
|
||||
view->SetLayerTarget( layer, KiGfx::TARGET_NONCACHED );
|
||||
}
|
||||
}
|
||||
|
||||
// Some more required layers settings
|
||||
view->SetRequired( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIAS_VISIBLE ) );
|
||||
view->SetRequired( ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) );
|
||||
view->SetRequired( ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) );
|
||||
view->SetRequired( ITEM_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
view->SetRequired( ITEM_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
|
||||
|
|
Loading…
Reference in New Issue