Commit 5447bb59 authored by Maciej Suminski's avatar Maciej Suminski

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

parent f0a52644
...@@ -292,6 +292,8 @@ public: ...@@ -292,6 +292,8 @@ public:
*/ */
inline void SetLayerVisible( int aLayer, bool aVisible = true ) inline void SetLayerVisible( int aLayer, bool aVisible = true )
{ {
wxASSERT( aLayer < (int) m_layers.size() );
if( m_layers[aLayer].visible != aVisible ) if( m_layers[aLayer].visible != aVisible )
{ {
// Target has to be redrawn after changing its visibility // Target has to be redrawn after changing its visibility
...@@ -307,9 +309,18 @@ public: ...@@ -307,9 +309,18 @@ public:
*/ */
inline bool IsLayerVisible( int aLayer ) const inline bool IsLayerVisible( int aLayer ) const
{ {
wxASSERT( aLayer < (int) m_layers.size() );
return m_layers.at( aLayer ).visible; 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() * Function SetLayerTarget()
* Changes the rendering target for a particular layer. * Changes the rendering target for a particular layer.
...@@ -318,6 +329,8 @@ public: ...@@ -318,6 +329,8 @@ public:
*/ */
inline void SetLayerTarget( int aLayer, RENDER_TARGET aTarget ) inline void SetLayerTarget( int aLayer, RENDER_TARGET aTarget )
{ {
wxASSERT( aLayer < (int) m_layers.size() );
m_layers[aLayer].target = aTarget; m_layers[aLayer].target = aTarget;
} }
...@@ -477,6 +490,8 @@ public: ...@@ -477,6 +490,8 @@ public:
/// Returns true if the layer is cached /// Returns true if the layer is cached
inline bool IsCached( int aLayer ) const inline bool IsCached( int aLayer ) const
{ {
wxASSERT( aLayer < (int) m_layers.size() );
return m_layers.at( aLayer ).target == TARGET_CACHED; return m_layers.at( aLayer ).target == TARGET_CACHED;
} }
......
...@@ -123,10 +123,12 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aGalType ) ...@@ -123,10 +123,12 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aGalType )
// Netnames are drawn only when scale is sufficient (level of details) // Netnames are drawn only when scale is sufficient (level of details)
// so there is no point in caching them // so there is no point in caching them
m_view->SetLayerTarget( layer, KIGFX::TARGET_NONCACHED ); m_view->SetLayerTarget( layer, KIGFX::TARGET_NONCACHED );
m_view->SetLayerDisplayOnly( layer );
} }
} }
m_view->SetLayerTarget( ITEM_GAL_LAYER( ANCHOR_VISIBLE ), KIGFX::TARGET_NONCACHED ); m_view->SetLayerTarget( ITEM_GAL_LAYER( ANCHOR_VISIBLE ), KIGFX::TARGET_NONCACHED );
m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( ANCHOR_VISIBLE ) );
// Some more required layers settings // Some more required layers settings
m_view->SetRequired( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ) ); 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 ) ...@@ -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->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->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->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). // 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) // Can be made only if the parent windos is a EDA_DRAW_FRAME (or a derived class)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment