From 98e5e64d80d921a02bc57f05c55c2e0e2426ab4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Tue, 18 Oct 2022 12:17:05 +0200 Subject: [PATCH] SVG: Fix reflection points for smooth curves after arcs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Internally, Agg/Mapnik converts arcs to curves. This means that the detection logic in the “smooth curve” command, which looks at the previous points for calculating the reflection point, mistakenly assumes that the previous commands were curve commands, even though they were in reality arc commands. To fix this, we add an explicit lineto command after every arc. --- include/mapnik/svg/svg_path_adapter.hpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/mapnik/svg/svg_path_adapter.hpp b/include/mapnik/svg/svg_path_adapter.hpp index a05277460..10ccb25f2 100644 --- a/include/mapnik/svg/svg_path_adapter.hpp +++ b/include/mapnik/svg/svg_path_adapter.hpp @@ -382,10 +382,12 @@ void path_adapter::arc_to(double rx, { join_path(a); } - else - { - line_to(x, y); - } + + // We are adding an explicit line_to, even if we've already add the + // bezier arc to the current path. This is to prevent subsequent smooth + // bezier curves from accidentally assuming that the previous command + // was a bezier curve as well when calculating reflection points. + line_to(x, y); } else {