Turned on group recaching on GAL change.
This commit is contained in:
parent
a96c5379b3
commit
5d704c9692
|
@ -143,7 +143,7 @@ VIEW::VIEW( bool aIsDynamic, bool aUseGroups ) :
|
|||
m_dynamic( aIsDynamic ),
|
||||
m_useGroups( aUseGroups )
|
||||
{
|
||||
// By default there is not layer on the top
|
||||
// By default there is no layer on the top
|
||||
m_topLayer.enabled = false;
|
||||
}
|
||||
|
||||
|
@ -201,6 +201,10 @@ void VIEW::SetGAL( GAL* aGal )
|
|||
{
|
||||
m_gal = aGal;
|
||||
|
||||
// items need to be recached after changing GAL
|
||||
if( m_useGroups )
|
||||
itemsRecache();
|
||||
|
||||
// force the new GAL to display the current viewport.
|
||||
SetCenter( m_center );
|
||||
SetScale( m_scale );
|
||||
|
@ -374,19 +378,14 @@ struct VIEW::drawItem
|
|||
{
|
||||
group = gal->BeginGroup();
|
||||
aItem->m_cachedGroup = group;
|
||||
aItem->ViewDraw( 0, gal, tmp );
|
||||
view->m_painter->Draw( static_cast<EDA_ITEM*>( aItem ), currentLayer );
|
||||
gal->EndGroup();
|
||||
gal->DrawGroup( group );
|
||||
}
|
||||
}
|
||||
else if( aItem->ViewIsVisible() )
|
||||
{
|
||||
if( !( view->m_painter
|
||||
&& view->m_painter->Draw( static_cast<EDA_ITEM*>( aItem ), currentLayer ) ) )
|
||||
{
|
||||
// Fallback, if there is no painter or painter does not know how to draw aItem
|
||||
aItem->ViewDraw( currentLayer, gal, tmp );
|
||||
}
|
||||
view->m_painter->Draw( static_cast<EDA_ITEM*>( aItem ), currentLayer );
|
||||
}
|
||||
|
||||
time += rdtsc() - ts;
|
||||
|
@ -445,6 +444,15 @@ struct VIEW::unlinkItem
|
|||
};
|
||||
|
||||
|
||||
struct VIEW::recacheItem
|
||||
{
|
||||
void operator()( VIEW_ITEM* aItem )
|
||||
{
|
||||
aItem->m_cachedGroup = -1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void VIEW::Clear()
|
||||
{
|
||||
BOX2I r;
|
||||
|
@ -544,3 +552,18 @@ void VIEW::clearGroupCache()
|
|||
l->items->Query( r, visitor );
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
void VIEW::itemsRecache()
|
||||
{
|
||||
BOX2I r;
|
||||
|
||||
r.SetMaximum();
|
||||
|
||||
for( LayerMapIter i = m_layers.begin(); i != m_layers.end(); ++i )
|
||||
{
|
||||
VIEW_LAYER* l = & ( ( *i ).second );
|
||||
recacheItem visitor;
|
||||
l->items->Query( r, visitor );
|
||||
};
|
||||
}
|
||||
|
|
|
@ -328,6 +328,7 @@ private:
|
|||
// Function objects that need to access VIEW/VIEW_ITEM private/protected members
|
||||
struct clearItemCache;
|
||||
struct unlinkItem;
|
||||
struct recacheItem;
|
||||
struct drawItem;
|
||||
|
||||
///* Saves current top layer settings in order to restore it when it's not top anymore
|
||||
|
@ -349,6 +350,9 @@ private:
|
|||
///* Clears cached GAL display lists
|
||||
void clearGroupCache();
|
||||
|
||||
///* Rebuilds GAL display lists
|
||||
void itemsRecache();
|
||||
|
||||
/// Determines rendering order of layers. Used in display order sorting function.
|
||||
static bool compareRenderingOrder( VIEW_LAYER* i, VIEW_LAYER* j )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue