Fixed VIEW::SetViewport().

This commit is contained in:
Maciej Suminski 2014-07-09 11:22:42 +02:00
parent cc733a4966
commit 13e67e1f3c
2 changed files with 8 additions and 12 deletions

View File

@ -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();
}

View File

@ -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 ) );