SVG cairo - push/pop group

This commit is contained in:
Artem Pavlenko 2022-11-26 12:50:57 +00:00
parent 0e5e77121c
commit d436c94c25

View file

@ -49,10 +49,13 @@ struct group_renderer
double opacity = g.opacity; double opacity = g.opacity;
if (opacity < 1.0) if (opacity < 1.0)
{ {
context_.push_group();
for (auto const& elem : g.elements) for (auto const& elem : g.elements)
{ {
mapbox::util::apply_visitor(group_renderer(transform_, context_, svg_path_, bbox_), elem); mapbox::util::apply_visitor(group_renderer(transform_, context_, svg_path_, bbox_), elem);
} }
context_.pop_group();
context_.paint(opacity);
} }
else else
{ {
@ -159,10 +162,13 @@ void render_vector_marker(cairo_context& context,
double adjusted_opacity = opacity * group_attrs.opacity; // adjust top level opacity double adjusted_opacity = opacity * group_attrs.opacity; // adjust top level opacity
if (adjusted_opacity < 1.0) if (adjusted_opacity < 1.0)
{ {
context.push_group();
for (auto const& elem : group_attrs.elements) for (auto const& elem : group_attrs.elements)
{ {
mapbox::util::apply_visitor(group_renderer(tr, context, svg_path, bbox), elem); mapbox::util::apply_visitor(group_renderer(tr, context, svg_path, bbox), elem);
} }
context.pop_group();
context.paint(opacity);
} }
else else
{ {