From 962bd03938e3e5cf513b91ed897ac11c248e827a Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Mon, 4 Nov 2024 21:31:39 +0200 Subject: [PATCH] Simplify a bit SVG diagonal percentage distances are defined in terms of viewBox diagonal length divided by sqrt(2) (normalized). See https://svgwg.org/svg2-draft/coords.html#Units Change-Id: I0d2101315d5f6c3333d021251eff17f6c13e804f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175991 Reviewed-by: Mike Kaganski Tested-by: Jenkins --- svgio/source/svgreader/SvgNumber.cxx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/svgio/source/svgreader/SvgNumber.cxx b/svgio/source/svgreader/SvgNumber.cxx index 72a44dbdd032..35293beee197 100644 --- a/svgio/source/svgreader/SvgNumber.cxx +++ b/svgio/source/svgreader/SvgNumber.cxx @@ -107,12 +107,8 @@ double SvgNumber::solve(const InfoProvider& rInfoProvider, NumberType aNumberTyp else // length { // it's a length, relative to sqrt((w^2 + h^2)/2) - const double fCurrentWidth(aViewPort.getWidth()); - const double fCurrentHeight(aViewPort.getHeight()); - const double fCurrentLength( - sqrt((fCurrentWidth * fCurrentWidth + fCurrentHeight * fCurrentHeight)/2.0)); - - fRetval *= fCurrentLength; + const double fDiagLength(std::hypot(aViewPort.getWidth(), aViewPort.getHeight())); + fRetval *= fDiagLength / M_SQRT2; } }