From 13e67e1f3cc3d2cf228ba6de0d94f66566fe0a52 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Wed, 9 Jul 2014 11:22:42 +0200 Subject: [PATCH] Fixed VIEW::SetViewport(). --- common/view/view.cpp | 18 +++++++----------- pcbnew/class_pad.cpp | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/common/view/view.cpp b/common/view/view.cpp index f877164c5b..44d808e4ed 100644 --- a/common/view/view.cpp +++ b/common/view/view.cpp @@ -252,9 +252,7 @@ void VIEW::SetGAL( GAL* aGal ) clearGroupCache(); // every target has to be refreshed - MarkTargetDirty( TARGET_CACHED ); - MarkTargetDirty( TARGET_NONCACHED ); - MarkTargetDirty( TARGET_OVERLAY ); + MarkDirty(); // force the new GAL to display the current viewport. SetCenter( m_center ); @@ -279,7 +277,7 @@ void VIEW::SetViewport( const BOX2D& aViewport, bool aKeepAspect ) VECTOR2D ssize = ToWorld( m_gal->GetScreenPixelSize(), false ); VECTOR2D centre = aViewport.Centre(); VECTOR2D vsize = aViewport.GetSize(); - double zoom = 1.0 / std::min( fabs( vsize.x / ssize.x ), fabs( vsize.y / ssize.y ) ); + double zoom = 1.0 / std::max( fabs( vsize.x / ssize.x ), fabs( vsize.y / ssize.y ) ); SetCenter( centre ); SetScale( GetScale() * zoom ); @@ -305,7 +303,7 @@ void VIEW::SetScale( double aScale, const VECTOR2D& aAnchor ) m_scale = aScale; // Redraw everything after the viewport has changed - MarkTargetDirty( TARGET_CACHED ); + MarkDirty(); } @@ -317,7 +315,7 @@ void VIEW::SetCenter( const VECTOR2D& aCenter ) m_gal->ComputeWorldScreenMatrix(); // Redraw everything after the viewport has changed - MarkTargetDirty( TARGET_CACHED ); + MarkDirty(); } @@ -574,7 +572,7 @@ struct VIEW::drawItem } VIEW* view; - int layer, layersCount, layers[VIEW_MAX_LAYERS]; + int layer, layers[VIEW_MAX_LAYERS]; }; @@ -734,9 +732,7 @@ void VIEW::ClearTargets() m_gal->ClearTarget( TARGET_NONCACHED ); m_gal->ClearTarget( TARGET_CACHED ); - MarkTargetDirty( TARGET_NONCACHED ); - MarkTargetDirty( TARGET_CACHED ); - MarkTargetDirty( TARGET_OVERLAY ); + MarkDirty(); } if( IsTargetDirty( TARGET_OVERLAY ) ) @@ -855,7 +851,7 @@ void VIEW::sortLayers() sort( m_orderedLayers.begin(), m_orderedLayers.end(), compareRenderingOrder ); - MarkTargetDirty( TARGET_CACHED ); + MarkDirty(); } diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 36239b7be0..a65bd54784 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -924,7 +924,7 @@ void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const unsigned int D_PAD::ViewGetLOD( int aLayer ) const { - // Netnames and soldermasks will be shown only if zoom is appropriate + // Netnames will be shown only if zoom is appropriate if( IsNetnameLayer( aLayer ) ) { return ( 100000000 / std::max( m_Size.x, m_Size.y ) );