Loading common/drawpanel_gal.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,10 @@ void EDA_DRAW_PANEL_GAL::Refresh( bool eraseBackground, const wxRect* rect ) m_gal->SetBackgroundColor( KiGfx::COLOR4D( 0.0, 0.0, 0.0, 1.0 ) ); m_gal->ClearScreen(); m_view->PrepareTargets(); // Grid has to be redrawn only when the NONCACHED target is redrawn if( m_view->IsTargetDirty( KiGfx::TARGET_NONCACHED ) ) m_gal->DrawGrid(); m_view->Redraw(); m_gal->EndDrawing(); Loading common/view/view.cpp +17 −14 Original line number Diff line number Diff line Loading @@ -546,7 +546,7 @@ void VIEW::redrawRect( const BOX2I& aRect ) { BOOST_FOREACH( VIEW_LAYER* l, m_orderedLayers ) { if( l->enabled && isTargetDirty( l->target ) && areRequiredLayersEnabled( l->id ) ) if( l->enabled && IsTargetDirty( l->target ) && areRequiredLayersEnabled( l->id ) ) { drawItem drawFunc( this, l ); Loading Loading @@ -622,7 +622,7 @@ bool VIEW::IsDirty() const { for( int i = 0; i < TARGETS_NUMBER; ++i ) { if( isTargetDirty( i ) ) if( IsTargetDirty( i ) ) return true; } Loading Loading @@ -695,14 +695,9 @@ void VIEW::Clear() } void VIEW::Redraw() void VIEW::PrepareTargets() { VECTOR2D screenSize = m_gal->GetScreenPixelSize(); BOX2I rect( ToWorld( VECTOR2D( 0, 0 ) ), ToWorld( screenSize ) - ToWorld( VECTOR2D( 0, 0 ) ) ); rect.Normalize(); if( isTargetDirty( TARGET_CACHED ) || isTargetDirty( TARGET_NONCACHED ) ) if( IsTargetDirty( TARGET_CACHED ) || IsTargetDirty( TARGET_NONCACHED ) ) { // TARGET_CACHED and TARGET_NONCACHED have to be redrawn together, as they contain // layers that rely on each other (eg. netnames are noncached, but tracks - are cached) Loading @@ -711,13 +706,21 @@ void VIEW::Redraw() MarkTargetDirty( TARGET_NONCACHED ); MarkTargetDirty( TARGET_CACHED ); m_gal->DrawGrid(); } // Always refresh the overlay MarkTargetDirty( TARGET_OVERLAY ); if( IsTargetDirty( TARGET_OVERLAY ) ) { m_gal->ClearTarget( TARGET_OVERLAY ); } } void VIEW::Redraw() { VECTOR2D screenSize = m_gal->GetScreenPixelSize(); BOX2I rect( ToWorld( VECTOR2D( 0, 0 ) ), ToWorld( screenSize ) - ToWorld( VECTOR2D( 0, 0 ) ) ); rect.Normalize(); redrawRect( rect ); Loading Loading @@ -892,7 +895,7 @@ void VIEW::RecacheAllItems( bool aImmediately ) } bool VIEW::isTargetDirty( int aTarget ) const bool VIEW::IsTargetDirty( int aTarget ) const { wxASSERT( aTarget < TARGETS_NUMBER ); Loading include/view/view.h +14 −8 Original line number Diff line number Diff line Loading @@ -362,6 +362,12 @@ public: */ void UpdateAllLayersOrder(); /** * Function PrepareTargets() * Clears targets that are marked as dirty. */ void PrepareTargets(); /** * Function Redraw() * Immediately redraws the whole view. Loading Loading @@ -397,6 +403,14 @@ public: */ bool IsDirty() const; /** * Function IsTargetDirty() * Returns true if any of layers belonging to the target or the target itself should be * redrawn. * @return True if the above condition is fulfilled. */ bool IsTargetDirty( int aTarget ) const; /** * Function MarkTargetDirty() * Sets or clears target 'dirty' flag. Loading Loading @@ -516,14 +530,6 @@ private: return ( m_layers.at( aLayer ).target == TARGET_CACHED ); } /** * Function isTargetDirty() * Returns true if any of layers belonging to the target or the target itself should be * redrawn. * @return True if the above condition is fulfilled. */ bool isTargetDirty( int aTarget ) const; ///* Whether to use rendering order modifier or not bool m_enableOrderModifier; Loading Loading
common/drawpanel_gal.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,10 @@ void EDA_DRAW_PANEL_GAL::Refresh( bool eraseBackground, const wxRect* rect ) m_gal->SetBackgroundColor( KiGfx::COLOR4D( 0.0, 0.0, 0.0, 1.0 ) ); m_gal->ClearScreen(); m_view->PrepareTargets(); // Grid has to be redrawn only when the NONCACHED target is redrawn if( m_view->IsTargetDirty( KiGfx::TARGET_NONCACHED ) ) m_gal->DrawGrid(); m_view->Redraw(); m_gal->EndDrawing(); Loading
common/view/view.cpp +17 −14 Original line number Diff line number Diff line Loading @@ -546,7 +546,7 @@ void VIEW::redrawRect( const BOX2I& aRect ) { BOOST_FOREACH( VIEW_LAYER* l, m_orderedLayers ) { if( l->enabled && isTargetDirty( l->target ) && areRequiredLayersEnabled( l->id ) ) if( l->enabled && IsTargetDirty( l->target ) && areRequiredLayersEnabled( l->id ) ) { drawItem drawFunc( this, l ); Loading Loading @@ -622,7 +622,7 @@ bool VIEW::IsDirty() const { for( int i = 0; i < TARGETS_NUMBER; ++i ) { if( isTargetDirty( i ) ) if( IsTargetDirty( i ) ) return true; } Loading Loading @@ -695,14 +695,9 @@ void VIEW::Clear() } void VIEW::Redraw() void VIEW::PrepareTargets() { VECTOR2D screenSize = m_gal->GetScreenPixelSize(); BOX2I rect( ToWorld( VECTOR2D( 0, 0 ) ), ToWorld( screenSize ) - ToWorld( VECTOR2D( 0, 0 ) ) ); rect.Normalize(); if( isTargetDirty( TARGET_CACHED ) || isTargetDirty( TARGET_NONCACHED ) ) if( IsTargetDirty( TARGET_CACHED ) || IsTargetDirty( TARGET_NONCACHED ) ) { // TARGET_CACHED and TARGET_NONCACHED have to be redrawn together, as they contain // layers that rely on each other (eg. netnames are noncached, but tracks - are cached) Loading @@ -711,13 +706,21 @@ void VIEW::Redraw() MarkTargetDirty( TARGET_NONCACHED ); MarkTargetDirty( TARGET_CACHED ); m_gal->DrawGrid(); } // Always refresh the overlay MarkTargetDirty( TARGET_OVERLAY ); if( IsTargetDirty( TARGET_OVERLAY ) ) { m_gal->ClearTarget( TARGET_OVERLAY ); } } void VIEW::Redraw() { VECTOR2D screenSize = m_gal->GetScreenPixelSize(); BOX2I rect( ToWorld( VECTOR2D( 0, 0 ) ), ToWorld( screenSize ) - ToWorld( VECTOR2D( 0, 0 ) ) ); rect.Normalize(); redrawRect( rect ); Loading Loading @@ -892,7 +895,7 @@ void VIEW::RecacheAllItems( bool aImmediately ) } bool VIEW::isTargetDirty( int aTarget ) const bool VIEW::IsTargetDirty( int aTarget ) const { wxASSERT( aTarget < TARGETS_NUMBER ); Loading
include/view/view.h +14 −8 Original line number Diff line number Diff line Loading @@ -362,6 +362,12 @@ public: */ void UpdateAllLayersOrder(); /** * Function PrepareTargets() * Clears targets that are marked as dirty. */ void PrepareTargets(); /** * Function Redraw() * Immediately redraws the whole view. Loading Loading @@ -397,6 +403,14 @@ public: */ bool IsDirty() const; /** * Function IsTargetDirty() * Returns true if any of layers belonging to the target or the target itself should be * redrawn. * @return True if the above condition is fulfilled. */ bool IsTargetDirty( int aTarget ) const; /** * Function MarkTargetDirty() * Sets or clears target 'dirty' flag. Loading Loading @@ -516,14 +530,6 @@ private: return ( m_layers.at( aLayer ).target == TARGET_CACHED ); } /** * Function isTargetDirty() * Returns true if any of layers belonging to the target or the target itself should be * redrawn. * @return True if the above condition is fulfilled. */ bool isTargetDirty( int aTarget ) const; ///* Whether to use rendering order modifier or not bool m_enableOrderModifier; Loading