Commit 13e67e1f authored by Maciej Suminski's avatar Maciej Suminski

Fixed VIEW::SetViewport().

parent cc733a49
...@@ -252,9 +252,7 @@ void VIEW::SetGAL( GAL* aGal ) ...@@ -252,9 +252,7 @@ void VIEW::SetGAL( GAL* aGal )
clearGroupCache(); clearGroupCache();
// every target has to be refreshed // every target has to be refreshed
MarkTargetDirty( TARGET_CACHED ); MarkDirty();
MarkTargetDirty( TARGET_NONCACHED );
MarkTargetDirty( TARGET_OVERLAY );
// force the new GAL to display the current viewport. // force the new GAL to display the current viewport.
SetCenter( m_center ); SetCenter( m_center );
...@@ -279,7 +277,7 @@ void VIEW::SetViewport( const BOX2D& aViewport, bool aKeepAspect ) ...@@ -279,7 +277,7 @@ void VIEW::SetViewport( const BOX2D& aViewport, bool aKeepAspect )
VECTOR2D ssize = ToWorld( m_gal->GetScreenPixelSize(), false ); VECTOR2D ssize = ToWorld( m_gal->GetScreenPixelSize(), false );
VECTOR2D centre = aViewport.Centre(); VECTOR2D centre = aViewport.Centre();
VECTOR2D vsize = aViewport.GetSize(); 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 ); SetCenter( centre );
SetScale( GetScale() * zoom ); SetScale( GetScale() * zoom );
...@@ -305,7 +303,7 @@ void VIEW::SetScale( double aScale, const VECTOR2D& aAnchor ) ...@@ -305,7 +303,7 @@ void VIEW::SetScale( double aScale, const VECTOR2D& aAnchor )
m_scale = aScale; m_scale = aScale;
// Redraw everything after the viewport has changed // Redraw everything after the viewport has changed
MarkTargetDirty( TARGET_CACHED ); MarkDirty();
} }
...@@ -317,7 +315,7 @@ void VIEW::SetCenter( const VECTOR2D& aCenter ) ...@@ -317,7 +315,7 @@ void VIEW::SetCenter( const VECTOR2D& aCenter )
m_gal->ComputeWorldScreenMatrix(); m_gal->ComputeWorldScreenMatrix();
// Redraw everything after the viewport has changed // Redraw everything after the viewport has changed
MarkTargetDirty( TARGET_CACHED ); MarkDirty();
} }
...@@ -574,7 +572,7 @@ struct VIEW::drawItem ...@@ -574,7 +572,7 @@ struct VIEW::drawItem
} }
VIEW* view; VIEW* view;
int layer, layersCount, layers[VIEW_MAX_LAYERS]; int layer, layers[VIEW_MAX_LAYERS];
}; };
...@@ -734,9 +732,7 @@ void VIEW::ClearTargets() ...@@ -734,9 +732,7 @@ void VIEW::ClearTargets()
m_gal->ClearTarget( TARGET_NONCACHED ); m_gal->ClearTarget( TARGET_NONCACHED );
m_gal->ClearTarget( TARGET_CACHED ); m_gal->ClearTarget( TARGET_CACHED );
MarkTargetDirty( TARGET_NONCACHED ); MarkDirty();
MarkTargetDirty( TARGET_CACHED );
MarkTargetDirty( TARGET_OVERLAY );
} }
if( IsTargetDirty( TARGET_OVERLAY ) ) if( IsTargetDirty( TARGET_OVERLAY ) )
...@@ -855,7 +851,7 @@ void VIEW::sortLayers() ...@@ -855,7 +851,7 @@ void VIEW::sortLayers()
sort( m_orderedLayers.begin(), m_orderedLayers.end(), compareRenderingOrder ); sort( m_orderedLayers.begin(), m_orderedLayers.end(), compareRenderingOrder );
MarkTargetDirty( TARGET_CACHED ); MarkDirty();
} }
......
...@@ -924,7 +924,7 @@ void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const ...@@ -924,7 +924,7 @@ void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const
unsigned int D_PAD::ViewGetLOD( int aLayer ) 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 ) ) if( IsNetnameLayer( aLayer ) )
{ {
return ( 100000000 / std::max( m_Size.x, m_Size.y ) ); return ( 100000000 / std::max( m_Size.x, m_Size.y ) );
......
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