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

Miklos Vajna vmiklos at collabora.co.uk
Wed Aug 17 09:00:35 UTC 2016


 writerfilter/source/rtftok/rtfsdrimport.cxx |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 8004bcd6e1180bdeae03200b2e5f6f93351d5e07
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Aug 17 08:04:58 2016 +0200

    sw: use std::lround() instead of manual rounding in RTFSdrImport
    
    Change-Id: If869c3f987996918904dca76de92d3e35789efa5

diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index c70050f..dd700c9 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -8,6 +8,7 @@
  */
 
 #include <rtfsdrimport.hxx>
+#include <cmath>
 #include <com/sun/star/container/XNamed.hpp>
 #include <com/sun/star/drawing/FillStyle.hpp>
 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
@@ -222,7 +223,7 @@ void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> const& xShape,
         sal_Int32 nRotation = aValue.toInt32()*100/65536;
         uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY);
         if (!xServiceInfo->supportsService("com.sun.star.text.TextFrame"))
-            xPropertySet->setPropertyValue("RotateAngle", uno::makeAny(sal_Int32(NormAngle360(nRotation * -1))));
+            xPropertySet->setPropertyValue("RotateAngle", uno::makeAny(sal_Int32(NormAngle360(static_cast<long>(nRotation) * -1))));
     }
 
     if (nHoriOrient != 0 && xPropertySet.is())
@@ -897,8 +898,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
             nTop = static_cast< sal_Int32 >(rShape.nTop + fHeightRatio * (*oRelTop - *oGroupTop));
 
             // See lclGetAbsRect() in the VML import.
-            aSize.Width = static_cast<sal_Int32>(fWidthRatio * (*oRelRight - *oRelLeft) + 0.5);
-            aSize.Height = static_cast<sal_Int32>(fHeightRatio * (*oRelBottom - *oRelTop) + 0.5);
+            aSize.Width = std::lround(fWidthRatio * (*oRelRight - *oRelLeft));
+            aSize.Height = std::lround(fHeightRatio * (*oRelBottom - *oRelTop));
         }
 
         if (m_bTextFrame)


More information about the Libreoffice-commits mailing list