bugfix: Pcbnew (Windows) crashes using selection tool in OpenGL or Cairo

This commit is contained in:
Maciej Suminski 2015-01-25 19:08:52 +01:00
parent f0a52644ea
commit 5447bb5914
2 changed files with 23 additions and 0 deletions

View File

@ -292,6 +292,8 @@ public:
*/
inline void SetLayerVisible( int aLayer, bool aVisible = true )
{
wxASSERT( aLayer < (int) m_layers.size() );
if( m_layers[aLayer].visible != aVisible )
{
// Target has to be redrawn after changing its visibility
@ -307,9 +309,18 @@ public:
*/
inline bool IsLayerVisible( int aLayer ) const
{
wxASSERT( aLayer < (int) m_layers.size() );
return m_layers.at( aLayer ).visible;
}
inline void SetLayerDisplayOnly( int aLayer, bool aDisplayOnly = true )
{
wxASSERT( aLayer < (int) m_layers.size() );
m_layers[aLayer].displayOnly = aDisplayOnly;
}
/**
* Function SetLayerTarget()
* Changes the rendering target for a particular layer.
@ -318,6 +329,8 @@ public:
*/
inline void SetLayerTarget( int aLayer, RENDER_TARGET aTarget )
{
wxASSERT( aLayer < (int) m_layers.size() );
m_layers[aLayer].target = aTarget;
}
@ -477,6 +490,8 @@ public:
/// Returns true if the layer is cached
inline bool IsCached( int aLayer ) const
{
wxASSERT( aLayer < (int) m_layers.size() );
return m_layers.at( aLayer ).target == TARGET_CACHED;
}

View File

@ -123,10 +123,12 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aGalType )
// Netnames are drawn only when scale is sufficient (level of details)
// so there is no point in caching them
m_view->SetLayerTarget( layer, KIGFX::TARGET_NONCACHED );
m_view->SetLayerDisplayOnly( layer );
}
}
m_view->SetLayerTarget( ITEM_GAL_LAYER( ANCHOR_VISIBLE ), KIGFX::TARGET_NONCACHED );
m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( ANCHOR_VISIBLE ) );
// Some more required layers settings
m_view->SetRequired( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ) );
@ -147,7 +149,13 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aGalType )
m_view->SetRequired( ITEM_GAL_LAYER( PAD_BK_VISIBLE ), ITEM_GAL_LAYER( MOD_BK_VISIBLE ) );
m_view->SetLayerTarget( ITEM_GAL_LAYER( GP_OVERLAY ), KIGFX::TARGET_OVERLAY );
m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( GP_OVERLAY ) );
m_view->SetLayerTarget( ITEM_GAL_LAYER( RATSNEST_VISIBLE ), KIGFX::TARGET_OVERLAY );
m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( RATSNEST_VISIBLE ) );
m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( WORKSHEET ) );
m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( GRID_VISIBLE ) );
m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( DRC_VISIBLE ) );
// Load display options (such as filled/outline display of items).
// Can be made only if the parent windos is a EDA_DRAW_FRAME (or a derived class)