From d436c94c2501ccafbc859a6dc03fb4c8379cabb5 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Sat, 26 Nov 2022 12:50:57 +0000 Subject: [PATCH] SVG cairo - push/pop group --- src/cairo/cairo_render_vector.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cairo/cairo_render_vector.cpp b/src/cairo/cairo_render_vector.cpp index f5c9adec9..41c514479 100644 --- a/src/cairo/cairo_render_vector.cpp +++ b/src/cairo/cairo_render_vector.cpp @@ -49,10 +49,13 @@ struct group_renderer double opacity = g.opacity; if (opacity < 1.0) { + context_.push_group(); for (auto const& elem : g.elements) { mapbox::util::apply_visitor(group_renderer(transform_, context_, svg_path_, bbox_), elem); } + context_.pop_group(); + context_.paint(opacity); } else { @@ -159,10 +162,13 @@ void render_vector_marker(cairo_context& context, double adjusted_opacity = opacity * group_attrs.opacity; // adjust top level opacity if (adjusted_opacity < 1.0) { + context.push_group(); for (auto const& elem : group_attrs.elements) { mapbox::util::apply_visitor(group_renderer(tr, context, svg_path, bbox), elem); } + context.pop_group(); + context.paint(opacity); } else {