summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-11-06 22:07:04 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-11-07 20:12:11 +0100
commit5b2a5a8543e544b1e0f5cee112232e2e67434942 (patch)
treefc56f029580747263d539edc0a90ea57af385002
parent7a5a7ce4e39ac57433c09980efb4dc2c0c40ee37 (diff)
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 <mike.kaganski@collabora.com> (cherry picked from commit 75395e0ccaeae2761a6b58bc36c8a5e32d49566f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142303 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
-rw-r--r--starmath/source/view.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 6cecfc941adf..4afb9a68a33c 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<sal_uInt16>(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;
}