diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-06 12:47:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-06 14:20:06 +0200 |
commit | bfc298d02ca6275588d5897d97ced9498a3e91aa (patch) | |
tree | 45f290e8a753a2e382b940ed7f3c43b2bac959cd /svx/source/svdraw/svdograf.cxx | |
parent | ee9cb297c583cb5a2e6ed388af31fffc79f282ca (diff) |
loplugin:flatten in svx/svdraw
Change-Id: I8379e5ebaee2090d2b4dbd05d55b55000915cd7c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100233
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/svdraw/svdograf.cxx')
-rw-r--r-- | svx/source/svdraw/svdograf.cxx | 62 |
1 files changed, 31 insertions, 31 deletions
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<float>(aSize.Width()) / - static_cast<float>(aSize.Height()); - float fWinWH = static_cast<float>(aMaxSize.Width()) / - static_cast<float>(aMaxSize.Height()); + Point aPos( rMaxRect.TopLeft() ); - // Scale graphic to page size - if ( fGrfWH < fWinWH ) - { - aSize.setWidth( static_cast<long>(aMaxSize.Height() * fGrfWH) ); - aSize.setHeight( aMaxSize.Height() ); - } - else if ( fGrfWH > 0.F ) - { - aSize.setWidth( aMaxSize.Width() ); - aSize.setHeight( static_cast<long>(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<float>(aSize.Width()) / + static_cast<float>(aSize.Height()); + float fWinWH = static_cast<float>(aMaxSize.Width()) / + static_cast<float>(aMaxSize.Height()); - aPos = rMaxRect.Center(); + // Scale graphic to page size + if ( fGrfWH < fWinWH ) + { + aSize.setWidth( static_cast<long>(aMaxSize.Height() * fGrfWH) ); + aSize.setHeight( aMaxSize.Height() ); + } + else if ( fGrfWH > 0.F ) + { + aSize.setWidth( aMaxSize.Width() ); + aSize.setHeight( static_cast<long>(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) |