summaryrefslogtreecommitdiff
path: root/svx/source/svdraw/svdomedia.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-06 12:47:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-06 14:20:06 +0200
commitbfc298d02ca6275588d5897d97ced9498a3e91aa (patch)
tree45f290e8a753a2e382b940ed7f3c43b2bac959cd /svx/source/svdraw/svdomedia.cxx
parentee9cb297c583cb5a2e6ed388af31fffc79f282ca (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/svdomedia.cxx')
-rw-r--r--svx/source/svdraw/svdomedia.cxx62
1 files changed, 31 insertions, 31 deletions
diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx
index 886ff96fd983..54ad20798a45 100644
--- a/svx/source/svdraw/svdomedia.cxx
+++ b/svx/source/svdraw/svdomedia.cxx
@@ -167,43 +167,43 @@ void SdrMediaObj::AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrin
MapMode(MapUnit::Map100thMM)) );
Size aMaxSize( rMaxRect.GetSize() );
- if( !aSize.IsEmpty() )
- {
- Point aPos( rMaxRect.TopLeft() );
+ if( aSize.IsEmpty() )
+ return;
- // if graphic is too large, fit it to the 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 graphic is too large, fit it to the 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 SdrMediaObj::setURL( const OUString& rURL, const OUString& rReferer, const OUString& rMimeType )