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 <mike.kaganski@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Mike Kaganski 2024-11-04 21:31:39 +02:00
parent 35b3abf583
commit 962bd03938

View file

@ -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;
}
}