sw/source/core/layout/fly.cxx |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

New commits:
commit 6ed9590303b416c958d8d4ae98386f517a332f7f
Author: Justin Luth <justin_l...@sil.org>
Date:   Tue Feb 20 14:37:17 2018 +0300

    nfc: use std::min in fly.cxx:CalcRel
    
    Other parts of CalcRel are already using std::min. It makes it
    much easier to read when the code is consistent.
    
    Change-Id: Ie3b07b96e48843271683cdf6a7dabca16cfab10b
    Reviewed-on: https://gerrit.libreoffice.org/50035
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Justin Luth <justin_l...@sil.org>
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 038dcdd58b5e..cfdcec89b779 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -2344,13 +2344,9 @@ Size SwFlyFrame::CalcRel( const SwFormatFrameSize &rSz ) 
const
             nRelWidth  = pSh->GetBrowseWidth();
             nRelHeight = pSh->VisArea().Height();
             Size aBorder = pSh->GetOut()->PixelToLogic( pSh->GetBrowseBorder() 
);
-            long nDiff = nRelWidth - pRel->getFramePrintArea().Width();
-            if ( nDiff > 0 )
-                nRelWidth -= nDiff;
+            nRelWidth  = std::min( nRelWidth,  
pRel->getFramePrintArea().Width() );
             nRelHeight -= 2*aBorder.Height();
-            nDiff = nRelHeight - pRel->getFramePrintArea().Height();
-            if ( nDiff > 0 )
-                nRelHeight -= nDiff;
+            nRelHeight = std::min( nRelHeight, 
pRel->getFramePrintArea().Height() );
         }
 
         // At the moment only the "== PAGE_FRAME" and "!= PAGE_FRAME" cases 
are handled.
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to