From 7605de7303f57c1320d96d5ff833f492d002cfb7 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 29 Oct 2023 16:45:53 +0300 Subject: Subtraction could wrap Change-Id: Ifc248835a70ee593e47d50bb0e1bf9165eb06391 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158623 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- starmath/inc/view.hxx | 4 ++-- starmath/source/document.cxx | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'starmath') diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index 8b17744d6171..03f67fdbed40 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -37,8 +37,8 @@ class SmPrintUIOptions; class SmGraphicAccessible; class SmGraphicWidget; -#define MINZOOM sal_uInt16(25) -#define MAXZOOM sal_uInt16(800) +constexpr sal_uInt16 MINZOOM = 25; +constexpr sal_uInt16 MAXZOOM = 800; class SmGraphicWindow final : public InterimItemWindow { diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 715525c94307..29dd3f2ef411 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -1549,7 +1549,8 @@ void SmDocShell::Impl_Print(OutputDevice& rOutDev, const SmPrintUIOptions& rPrin sal_uInt16 nZ = std::min(o3tl::convert(OutputSize.Width(), 100, GraphicSize.Width()), o3tl::convert(OutputSize.Height(), 100, GraphicSize.Height())); - nZ -= 10; + if (nZ > MINZOOM) + nZ -= 10; Fraction aFraction(std::clamp(nZ, MINZOOM, MAXZOOM), 100); OutputMapMode = MapMode(SmMapUnit(), Point(), aFraction, aFraction); -- cgit