From bfc298d02ca6275588d5897d97ced9498a3e91aa Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 6 Aug 2020 12:47:09 +0200 Subject: loplugin:flatten in svx/svdraw Change-Id: I8379e5ebaee2090d2b4dbd05d55b55000915cd7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100233 Tested-by: Jenkins Reviewed-by: Noel Grandin --- svx/source/svdraw/svdograf.cxx | 62 +++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'svx/source/svdraw/svdograf.cxx') diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index beac686d733d..2f2c4886f86d 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -1059,43 +1059,43 @@ void SdrGrafObj::AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrink mpGraphicObject->GetPrefMapMode(), MapMode( MapUnit::Map100thMM ) ); - if( !aSize.IsEmpty() ) - { - Point aPos( rMaxRect.TopLeft() ); + if( aSize.IsEmpty() ) + return; - // if the graphic is too large, fit it to page - if ( (!bShrinkOnly || - ( aSize.Height() > aMaxSize.Height() ) || - ( aSize.Width() > aMaxSize.Width() ) )&& - aSize.Height() && aMaxSize.Height() ) - { - float fGrfWH = static_cast(aSize.Width()) / - static_cast(aSize.Height()); - float fWinWH = static_cast(aMaxSize.Width()) / - static_cast(aMaxSize.Height()); + Point aPos( rMaxRect.TopLeft() ); - // Scale graphic to page size - if ( fGrfWH < fWinWH ) - { - aSize.setWidth( static_cast(aMaxSize.Height() * fGrfWH) ); - aSize.setHeight( aMaxSize.Height() ); - } - else if ( fGrfWH > 0.F ) - { - aSize.setWidth( aMaxSize.Width() ); - aSize.setHeight( static_cast(aMaxSize.Width() / fGrfWH) ); - } + // if the graphic is too large, fit it to page + if ( (!bShrinkOnly || + ( aSize.Height() > aMaxSize.Height() ) || + ( aSize.Width() > aMaxSize.Width() ) )&& + aSize.Height() && aMaxSize.Height() ) + { + float fGrfWH = static_cast(aSize.Width()) / + static_cast(aSize.Height()); + float fWinWH = static_cast(aMaxSize.Width()) / + static_cast(aMaxSize.Height()); - aPos = rMaxRect.Center(); + // Scale graphic to page size + if ( fGrfWH < fWinWH ) + { + aSize.setWidth( static_cast(aMaxSize.Height() * fGrfWH) ); + aSize.setHeight( aMaxSize.Height() ); + } + else if ( fGrfWH > 0.F ) + { + aSize.setWidth( aMaxSize.Width() ); + aSize.setHeight( static_cast(aMaxSize.Width() / fGrfWH) ); } - if( bShrinkOnly ) - aPos = maRect.TopLeft(); - - aPos.AdjustX( -(aSize.Width() / 2) ); - aPos.AdjustY( -(aSize.Height() / 2) ); - SetLogicRect( tools::Rectangle( aPos, aSize ) ); + aPos = rMaxRect.Center(); } + + if( bShrinkOnly ) + aPos = maRect.TopLeft(); + + aPos.AdjustX( -(aSize.Width() / 2) ); + aPos.AdjustY( -(aSize.Height() / 2) ); + SetLogicRect( tools::Rectangle( aPos, aSize ) ); } void SdrGrafObj::SetGrafAnimationAllowed(bool bNew) -- cgit