From 48b667a7e7d25f835f95df89162a7849d6972531 Mon Sep 17 00:00:00 2001 From: Noel Date: Wed, 11 Nov 2020 21:59:38 +0200 Subject: remove Fraction::operator tools::Long() which was added in commit 331e2e5ed3bf4e0b2c1fab3b7bca836170317827 Author: Noel Grandin Date: Thu Sep 14 08:49:52 2017 +0200 long->sal_Int32 in Fraction presumably to make the change impact less code. Instead, update the call sites to reflect the actual bitwidth of the data we will be receiving. Change-Id: If2a678b1cf534f39cb8cb249757462be53658309 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105607 Tested-by: Jenkins Reviewed-by: Noel Grandin --- starmath/source/mathmlimport.cxx | 4 ++-- starmath/source/node.cxx | 6 +++--- starmath/source/utility.cxx | 4 ++-- starmath/source/view.cxx | 10 +++++----- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'starmath') diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index 7a3ca34b9a5a..510b24852cee 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -1504,12 +1504,12 @@ bool lcl_CountBlanks(const MathMLAttributeLengthValue &rLV, return false; const Fraction aTwo(2, 1); auto aWide = rLV.aNumber / aTwo; - auto nWide = static_cast(static_cast(aWide)); + auto nWide = static_cast(aWide); if (nWide < 0) return false; const Fraction aPointFive(1, 2); auto aNarrow = (rLV.aNumber - Fraction(nWide, 1) * aTwo) / aPointFive; - auto nNarrow = static_cast(static_cast(aNarrow)); + auto nNarrow = static_cast(aNarrow); if (nNarrow < 0) return false; *pWide = nWide; diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 3c78de3ba5b0..6e88cff4dce0 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -154,7 +154,7 @@ void SmNode::SetFontSize(const Fraction &rSize, FontSizeType nType) { Fraction aVal (SmPtsTo100th_mm(rSize.GetNumerator()), rSize.GetDenominator()); - tools::Long nHeight = static_cast(aVal); + tools::Long nHeight = static_cast(aVal); aFntSize = GetFont().GetFontSize(); aFntSize.setWidth( 0 ); @@ -173,12 +173,12 @@ void SmNode::SetFontSize(const Fraction &rSize, FontSizeType nType) break; case FontSizeType::MULTIPLY: - aFntSize.setHeight( static_cast(Fraction(aFntSize.Height()) * rSize) ); + aFntSize.setHeight( static_cast(Fraction(aFntSize.Height()) * rSize) ); break; case FontSizeType::DIVIDE: if (rSize != Fraction(0)) - aFntSize.setHeight( static_cast(Fraction(aFntSize.Height()) / rSize) ); + aFntSize.setHeight( static_cast(Fraction(aFntSize.Height()) / rSize) ); break; default: break; diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx index 7012004bea94..8e04a3c0073d 100644 --- a/starmath/source/utility.cxx +++ b/starmath/source/utility.cxx @@ -230,8 +230,8 @@ SmFace & operator *= (SmFace &rFace, const Fraction &rFrac) // It's main use is to make scaling fonts look easier. { const Size &rFaceSize = rFace.GetFontSize(); - rFace.SetSize(Size(tools::Long(rFaceSize.Width() * rFrac), - tools::Long(rFaceSize.Height() * rFrac))); + rFace.SetSize(Size(sal_Int32(rFaceSize.Width() * rFrac), + sal_Int32(rFaceSize.Height() * rFrac))); return rFace; } diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 638a41b2daa2..b893dfb88529 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -906,7 +906,7 @@ void SmViewShell::QueryObjAreaPixel( tools::Rectangle& rRect ) const void SmViewShell::SetZoomFactor( const Fraction &rX, const Fraction &rY ) { const Fraction &rFrac = std::min(rX, rY); - GetGraphicWindow().SetZoom(sal::static_int_cast(tools::Long(rFrac * Fraction( 100, 1 )))); + GetGraphicWindow().SetZoom(sal::static_int_cast(sal_Int32(rFrac * Fraction( 100, 1 )))); //To avoid rounding errors base class regulates crooked values too //if necessary @@ -1190,8 +1190,8 @@ void SmViewShell::Impl_Print(OutputDevice &rOutDev, const SmPrintUIOptions &rPri Size OutputSize (rOutDev.LogicToPixel(Size(aOutRect.GetWidth(), aOutRect.GetHeight()), MapMode(MapUnit::Map100thMM))); Size GraphicSize (rOutDev.LogicToPixel(aSize, MapMode(MapUnit::Map100thMM))); - sal_uInt16 nZ = sal::static_int_cast(std::min(tools::Long(Fraction(OutputSize.Width() * 100, GraphicSize.Width())), - tools::Long(Fraction(OutputSize.Height() * 100, GraphicSize.Height())))); + sal_uInt16 nZ = sal::static_int_cast(std::min(sal_Int32(Fraction(OutputSize.Width() * 100, GraphicSize.Width())), + sal_Int32(Fraction(OutputSize.Height() * 100, GraphicSize.Height())))); nZ -= 10; Fraction aFraction (std::max(MINZOOM, std::min(MAXZOOM, nZ)), 100); @@ -2012,8 +2012,8 @@ void SmViewShell::ZoomByItemSet(const SfxItemSet *pSet) Size OutputSize(pPrinter->LogicToPixel(Size(OutputRect.GetWidth(), OutputRect.GetHeight()), aMap)); Size GraphicSize(pPrinter->LogicToPixel(GetDoc()->GetSize(), aMap)); - sal_uInt16 nZ = sal::static_int_cast(std::min(tools::Long(Fraction(OutputSize.Width() * 100, GraphicSize.Width())), - tools::Long(Fraction(OutputSize.Height() * 100, GraphicSize.Height())))); + sal_uInt16 nZ = sal::static_int_cast(std::min(sal_Int32(Fraction(OutputSize.Width() * 100, GraphicSize.Width())), + sal_Int32(Fraction(OutputSize.Height() * 100, GraphicSize.Height())))); mpGraphic->SetZoom (nZ); break; } -- cgit