From 8bc1aad37f42638b649846b8a6abd6a9d5f6d859 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Thu, 24 Nov 2022 10:34:25 +0000 Subject: [PATCH] SVG - convert USER_SPACE_ON_USE radial gradient values to % (fix) [WIP] [skip ci] --- src/svg/svg_parser.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/svg/svg_parser.cpp b/src/svg/svg_parser.cpp index 00352b0a8..c05900c17 100644 --- a/src/svg/svg_parser.cpp +++ b/src/svg/svg_parser.cpp @@ -1570,11 +1570,18 @@ void parse_radial_gradient(svg_parser& parser, rapidxml::xml_node const* n r = parse_svg_value(parser, attr->value(), has_percent); } // this logic for detecting %'s will not support mixed coordinates. - if (has_percent && gr.get_units() == USER_SPACE_ON_USE) + if (gr.get_units() == USER_SPACE_ON_USE) { + if (!has_percent && parser.path_.width() > 0 && parser.path_.height() > 0) + { + fx /= parser.path_.width(); + fy /= parser.path_.height(); + cx /= parser.path_.width(); + cy /= parser.path_.height(); + r /= parser.path_.width(); + } gr.set_units(USER_SPACE_ON_USE_BOUNDING_BOX); } - gr.set_gradient_type(RADIAL); gr.set_control_points(fx, fy, cx, cy, r);