From 75395e0ccaeae2761a6b58bc36c8a5e32d49566f Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 6 Nov 2022 22:07:04 +0300 Subject: [PATCH] Use o3tl::convert instead of temporary Fractions Change-Id: I7e1f68e579e6520d17e0a058e6e0a8056e082c2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142360 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- starmath/source/view.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 1bcfc0d3efc7..8898d10bf5a1 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -2295,8 +2295,10 @@ 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())))); + if (GraphicSize.Width() <= 0 || GraphicSize.Height() <= 0) + break; + sal_uInt16 nZ = std::min(o3tl::convert(OutputSize.Width(), 100, GraphicSize.Width()), + o3tl::convert(OutputSize.Height(), 100, GraphicSize.Height())); mxGraphicWindow->SetZoom(nZ); break; } -- 2.11.4.GIT