diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-14 12:50:42 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-15 06:34:33 +0200 |
commit | 690526f95e3ee4fd25bb2c987e093543e4bc435b (patch) | |
tree | 06b6bb7b6c907fb1876eac1e60b7dac952b21f7b /editeng | |
parent | 1dc92b9e9951ef118d2d823d54f9a022c2e41a27 (diff) |
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 <mike.kaganski@collabora.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 6 | ||||
-rw-r--r-- | editeng/source/editeng/impedit4.cxx | 3 | ||||
-rw-r--r-- | editeng/source/outliner/outliner.cxx | 4 |
3 files changed, 6 insertions, 7 deletions
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<tools::Long>(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<tools::Long>(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<tools::Long>(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<tools::Long>(double(aBulletArea.Left()) * fSpacingFactorX); + tools::Long nStretchBulletWidth = basegfx::fround<tools::Long>(double(aBulletArea.GetWidth()) * fSpacingFactorX); aBulletArea = tools::Rectangle(Point(nStretchBulletX, aBulletArea.Top()), Size(nStretchBulletWidth, aBulletArea.GetHeight()) ); |