[Libreoffice-commits] core.git: vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 30 08:11:27 UTC 2021


 vcl/source/window/window2.cxx |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

New commits:
commit 0aea0cee58fe77a9058217dfdfc3d6a02b29ee2a
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jun 29 20:50:04 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jun 30 10:10:53 2021 +0200

    WinFloatRound has the same content as FRound
    
    Change-Id: Iaf1565d937ded7ab675ab216aef0100dd7af92e4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118136
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 3975629e5838..db6f493cc342 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -22,6 +22,8 @@
 #include <o3tl/float_int_conversion.hxx>
 #include <sal/log.hxx>
 
+#include <tools/helpers.hxx>
+
 #include <vcl/toolkit/dialog.hxx>
 #include <vcl/event.hxx>
 #include <vcl/toolkit/fixed.hxx>
@@ -369,11 +371,6 @@ void Window::SetZoom( const Fraction& rZoom )
     }
 }
 
-static tools::Long WinFloatRound( double fVal )
-{
-    return( fVal > 0.0 ? static_cast<tools::Long>( fVal + 0.5 ) : -static_cast<tools::Long>( -fVal + 0.5 ) );
-}
-
 void Window::SetZoomedPointFont(vcl::RenderContext& rRenderContext, const vcl::Font& rFont)
 {
     const Fraction& rZoom = GetZoom();
@@ -381,8 +378,8 @@ void Window::SetZoomedPointFont(vcl::RenderContext& rRenderContext, const vcl::F
     {
         vcl::Font aFont(rFont);
         Size aSize = aFont.GetFontSize();
-        aSize.setWidth( WinFloatRound(double(aSize.Width() * rZoom)) );
-        aSize.setHeight( WinFloatRound(double(aSize.Height() * rZoom)) );
+        aSize.setWidth( FRound(double(aSize.Width() * rZoom)) );
+        aSize.setHeight( FRound(double(aSize.Height() * rZoom)) );
         aFont.SetFontSize(aSize);
         SetPointFont(rRenderContext, aFont);
     }
@@ -399,7 +396,7 @@ tools::Long Window::CalcZoom( tools::Long nCalc ) const
     if ( rZoom.GetNumerator() != rZoom.GetDenominator() )
     {
         double n = double(nCalc * rZoom);
-        nCalc = WinFloatRound( n );
+        nCalc = FRound( n );
     }
     return nCalc;
 }


More information about the Libreoffice-commits mailing list