From 690526f95e3ee4fd25bb2c987e093543e4bc435b Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 14 Apr 2024 12:50:42 +0500 Subject: Generalize basegfx::fround for templated return type And use it when assigning to tools::Long Change-Id: I0814d7bac9cdd48191ba69c64e3b12a4973b3417 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166071 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- editeng/source/editeng/impedit3.cxx | 6 +++--- editeng/source/editeng/impedit4.cxx | 3 +-- editeng/source/outliner/outliner.cxx | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'editeng') diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 75fe99e684ee..72bc2022b1ea 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -1070,7 +1070,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) // consider scaling double fFontScalingX = maScalingParameters.fFontX; if (maStatus.DoStretch() && (fFontScalingX != 1.0)) - nCurPos = basegfx::fround(double(nCurPos) / std::max(fFontScalingX, 0.01)); + nCurPos = basegfx::fround(double(nCurPos) / std::max(fFontScalingX, 0.01)); short nAllSpaceBeforeText = short(rLRItem.GetTextLeft()); aCurrentTab.aTabStop = pNode->GetContentAttribs().FindTabStop( nCurPos - nAllSpaceBeforeText , maEditDoc.GetDefTab() ); @@ -3090,7 +3090,7 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_Int32 nPos, SvxFont& rFo double fHeightRounded = roundToNearestPt(aRealSz.Height()); double fNewHeight = fHeightRounded * maScalingParameters.fFontY; fNewHeight = roundToNearestPt(fNewHeight); - aRealSz.setHeight(basegfx::fround(fNewHeight)); + aRealSz.setHeight(basegfx::fround(fNewHeight)); } if (maScalingParameters.fFontX != 1.0) { @@ -3105,7 +3105,7 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_Int32 nPos, SvxFont& rFo double fWidthRounded = roundToNearestPt(aRealSz.Width()); double fNewWidth = fWidthRounded * fFontX; fNewWidth = roundToNearestPt(fNewWidth); - aRealSz.setWidth(basegfx::fround(fNewWidth)); + aRealSz.setWidth(basegfx::fround(fNewWidth)); // Also the Kerning: (long due to handle Interim results) tools::Long nKerning = rFont.GetFixKerning(); diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index b7d4be999016..121259f7e394 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -3139,8 +3139,7 @@ double ImpEditEngine::roundToNearestPt(double fInput) const if (mbRoundToNearestPt) { double fInputPt = o3tl::convert(fInput, o3tl::Length::mm100, o3tl::Length::pt); - auto nInputRounded = basegfx::fround(fInputPt); - return o3tl::convert(double(nInputRounded), o3tl::Length::pt, o3tl::Length::mm100); + return o3tl::convert(std::round(fInputPt), o3tl::Length::pt, o3tl::Length::mm100); } else { diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 2e8541e72051..671ecd017cfd 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -891,8 +891,8 @@ void Outliner::PaintBullet(sal_Int32 nPara, const Point& rStartPos, const Point& double fSpacingFactorX = getScalingParameters().fSpacingX; - tools::Long nStretchBulletX = basegfx::fround(double(aBulletArea.Left()) * fSpacingFactorX); - tools::Long nStretchBulletWidth = basegfx::fround(double(aBulletArea.GetWidth()) * fSpacingFactorX); + tools::Long nStretchBulletX = basegfx::fround(double(aBulletArea.Left()) * fSpacingFactorX); + tools::Long nStretchBulletWidth = basegfx::fround(double(aBulletArea.GetWidth()) * fSpacingFactorX); aBulletArea = tools::Rectangle(Point(nStretchBulletX, aBulletArea.Top()), Size(nStretchBulletWidth, aBulletArea.GetHeight()) ); -- cgit