starmath/source/view.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
New commits: commit 5b2a5a8543e544b1e0f5cee112232e2e67434942 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sun Nov 6 22:07:04 2022 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Mon Nov 7 20:12:11 2022 +0100 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.kagan...@collabora.com> (cherry picked from commit 75395e0ccaeae2761a6b58bc36c8a5e32d49566f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142303 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> 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; }