Make OpenGL GAL great again

Reenabled VIEW_ITEMs cache. Previously, the first init was called with
GAL_TYPE_NONE, causing all layers to be set to non-cached. During the
proper init, the layers were already set to non-cached and were not
changed.
This commit is contained in:
Maciej Suminski 2017-03-10 12:58:38 +01:00
parent 11f8e53e27
commit 737dc20409
1 changed files with 6 additions and 13 deletions

View File

@ -377,6 +377,12 @@ bool PCB_DRAW_PANEL_GAL::SwitchBackend( GAL_TYPE aGalType )
void PCB_DRAW_PANEL_GAL::setDefaultLayerDeps() void PCB_DRAW_PANEL_GAL::setDefaultLayerDeps()
{ {
// caching makes no sense for Cairo and other software renderers
auto target = m_backend == GAL_TYPE_OPENGL ? KIGFX::TARGET_CACHED : KIGFX::TARGET_NONCACHED;
for( int i = 0; i < KIGFX::VIEW::VIEW_MAX_LAYERS; i++ )
m_view->SetLayerTarget( i, target );
for( LAYER_NUM i = 0; (unsigned) i < sizeof( GAL_LAYER_ORDER ) / sizeof( LAYER_NUM ); ++i ) for( LAYER_NUM i = 0; (unsigned) i < sizeof( GAL_LAYER_ORDER ) / sizeof( LAYER_NUM ); ++i )
{ {
LAYER_NUM layer = GAL_LAYER_ORDER[i]; LAYER_NUM layer = GAL_LAYER_ORDER[i];
@ -384,22 +390,9 @@ void PCB_DRAW_PANEL_GAL::setDefaultLayerDeps()
// Set layer display dependencies & targets // Set layer display dependencies & targets
if( IsCopperLayer( layer ) ) if( IsCopperLayer( layer ) )
{
m_view->SetRequired( GetNetnameLayer( layer ), layer ); m_view->SetRequired( GetNetnameLayer( layer ), layer );
m_view->SetLayerTarget( layer, KIGFX::TARGET_CACHED );
}
else if( IsNetnameLayer( layer ) ) else if( IsNetnameLayer( layer ) )
{
m_view->SetLayerDisplayOnly( layer ); m_view->SetLayerDisplayOnly( layer );
m_view->SetLayerTarget( layer, KIGFX::TARGET_CACHED );
}
}
// caching makes no sense for Cairo and other software renderers
if ( m_backend != GAL_TYPE_OPENGL )
{
for( int i = 0; i < KIGFX::VIEW::VIEW_MAX_LAYERS; i++ )
m_view->SetLayerTarget( i, KIGFX::TARGET_NONCACHED );
} }
m_view->SetLayerTarget( ITEM_GAL_LAYER( ANCHOR_VISIBLE ), KIGFX::TARGET_NONCACHED ); m_view->SetLayerTarget( ITEM_GAL_LAYER( ANCHOR_VISIBLE ), KIGFX::TARGET_NONCACHED );