From eca53baf6fad4770b6cf4b08fc2a14f9a10e1122 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Mon, 26 Aug 2013 10:43:22 +0200 Subject: [PATCH] Fixed linking errors for apps other than pcbnew. --- common/drawpanel_gal.cpp | 4 ++++ common/view/view.cpp | 33 ++++++++++++++++++--------------- include/view/view.h | 22 ++++++++++++++-------- 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/common/drawpanel_gal.cpp b/common/drawpanel_gal.cpp index 678994b788..4bc6a0103d 100644 --- a/common/drawpanel_gal.cpp +++ b/common/drawpanel_gal.cpp @@ -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(); diff --git a/common/view/view.cpp b/common/view/view.cpp index 4c2a0aa9e0..290d51c92c 100644 --- a/common/view/view.cpp +++ b/common/view/view.cpp @@ -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 ); @@ -622,7 +622,7 @@ bool VIEW::IsDirty() const { for( int i = 0; i < TARGETS_NUMBER; ++i ) { - if( isTargetDirty( i ) ) + if( IsTargetDirty( i ) ) return true; } @@ -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) @@ -711,13 +706,21 @@ void VIEW::Redraw() MarkTargetDirty( TARGET_NONCACHED ); MarkTargetDirty( TARGET_CACHED ); - - m_gal->DrawGrid(); } - // Always refresh the overlay - MarkTargetDirty( TARGET_OVERLAY ); - m_gal->ClearTarget( 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 ); @@ -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 ); diff --git a/include/view/view.h b/include/view/view.h index 89155099df..3fd1935db6 100644 --- a/include/view/view.h +++ b/include/view/view.h @@ -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. @@ -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. @@ -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;