diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-21 15:49:27 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-22 12:15:38 +0100 |
commit | 3fbbd74b7bc6aef4af5f0c4b23a73a6726b9afbf (patch) | |
tree | b3a0df75c42a93645f5342863a7291c871e520eb /svx/source/svdraw/svdpntv.cxx | |
parent | 4b7490fe49bb93f895e974602a2616fa80b74019 (diff) |
loplugin:flatten in svx
Change-Id: Idc4d0186ecc6f0722c2b1358486a2430f037ae29
Reviewed-on: https://gerrit.libreoffice.org/45036
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/svdraw/svdpntv.cxx')
-rw-r--r-- | svx/source/svdraw/svdpntv.cxx | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index 51174785edff..625578db868c 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -1127,47 +1127,47 @@ void SdrPaintView::MakeVisible(const tools::Rectangle& rRect, vcl::Window& rWin) MapMode aMap(rWin.GetMapMode()); Size aActualSize(rWin.GetOutputSize()); - if( aActualSize.Height() > 0 && aActualSize.Width() > 0 ) + if( aActualSize.Height() <= 0 || aActualSize.Width() <= 0 ) + return; + + Size aNewSize(rRect.GetSize()); + bool bNewScale=false; + bool bNeedMoreX=aNewSize.Width()>aActualSize.Width(); + bool bNeedMoreY=aNewSize.Height()>aActualSize.Height(); + if (bNeedMoreX || bNeedMoreY) { - Size aNewSize(rRect.GetSize()); - bool bNewScale=false; - bool bNeedMoreX=aNewSize.Width()>aActualSize.Width(); - bool bNeedMoreY=aNewSize.Height()>aActualSize.Height(); - if (bNeedMoreX || bNeedMoreY) - { - bNewScale=true; - // set new MapMode (Size+Org) and invalidate everything - Fraction aXFact(aNewSize.Width(),aActualSize.Width()); - Fraction aYFact(aNewSize.Height(),aActualSize.Height()); - if (aYFact>aXFact) aXFact=aYFact; - aXFact*=aMap.GetScaleX(); - aXFact.ReduceInaccurate(10); // to avoid runovers and BigInt mapping - aMap.SetScaleX(aXFact); - aMap.SetScaleY(aYFact); + bNewScale=true; + // set new MapMode (Size+Org) and invalidate everything + Fraction aXFact(aNewSize.Width(),aActualSize.Width()); + Fraction aYFact(aNewSize.Height(),aActualSize.Height()); + if (aYFact>aXFact) aXFact=aYFact; + aXFact*=aMap.GetScaleX(); + aXFact.ReduceInaccurate(10); // to avoid runovers and BigInt mapping + aMap.SetScaleX(aXFact); + aMap.SetScaleY(aYFact); + rWin.SetMapMode(aMap); + aActualSize=rWin.GetOutputSize(); + } + Point aOrg(aMap.GetOrigin()); + long dx=0,dy=0; + long l=-aOrg.X(); + long r=-aOrg.X()+aActualSize.Width()-1; + long o=-aOrg.Y(); + long u=-aOrg.Y()+aActualSize.Height()-1; + if (l>rRect.Left()) dx=rRect.Left()-l; + else if (r<rRect.Right()) dx=rRect.Right()-r; + if (o>rRect.Top()) dy=rRect.Top()-o; + else if (u<rRect.Bottom()) dy=rRect.Bottom()-u; + aMap.SetOrigin(Point(aOrg.X()-dx,aOrg.Y()-dy)); + if (!bNewScale) { + if (dx!=0 || dy!=0) { + rWin.Scroll(-dx,-dy); rWin.SetMapMode(aMap); - aActualSize=rWin.GetOutputSize(); - } - Point aOrg(aMap.GetOrigin()); - long dx=0,dy=0; - long l=-aOrg.X(); - long r=-aOrg.X()+aActualSize.Width()-1; - long o=-aOrg.Y(); - long u=-aOrg.Y()+aActualSize.Height()-1; - if (l>rRect.Left()) dx=rRect.Left()-l; - else if (r<rRect.Right()) dx=rRect.Right()-r; - if (o>rRect.Top()) dy=rRect.Top()-o; - else if (u<rRect.Bottom()) dy=rRect.Bottom()-u; - aMap.SetOrigin(Point(aOrg.X()-dx,aOrg.Y()-dy)); - if (!bNewScale) { - if (dx!=0 || dy!=0) { - rWin.Scroll(-dx,-dy); - rWin.SetMapMode(aMap); - rWin.Update(); - } - } else { - rWin.SetMapMode(aMap); - InvalidateOneWin(rWin); + rWin.Update(); } + } else { + rWin.SetMapMode(aMap); + InvalidateOneWin(rWin); } } |