SVG parser - only set SVG dimensions top level <svg> element

This commit is contained in:
Artem Pavlenko 2022-12-19 12:29:04 +00:00
parent 32263cde89
commit 53288c5dd2
2 changed files with 6 additions and 1 deletions

View file

@ -106,6 +106,7 @@ class MAPNIK_DECL svg_parser : private util::noncopyable
bool strict_;
bool ignore_;
bool css_style_;
bool dimensions_ = false;
std::map<std::string, gradient> gradient_map_;
std::map<std::string, boost::property_tree::detail::rapidxml::xml_node<char> const*> node_cache_;
mapnik::css_data css_data_;

View file

@ -1000,7 +1000,11 @@ void parse_dimensions(svg_parser& parser, rapidxml::xml_node<char> const* node)
parser.path_.set_dimensions(0, 0);
return;
}
parser.path_.set_dimensions(width, height);
if (!parser.dimensions_)
{
parser.dimensions_ = true;
parser.path_.set_dimensions(width, height);
}
}
void parse_path(svg_parser& parser, rapidxml::xml_node<char> const* node)