diff options
author | jaseg <git@jaseg.de> | 2022-06-21 16:23:09 +0200 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2022-06-21 16:23:09 +0200 |
commit | e76d257220cb98cf8286b077cad248de62a6abc8 (patch) | |
tree | 16c3285f8c2f7a3818552f1fd2851dc032f2f7c2 /svg-flatten/src/svg_path.cpp | |
parent | 29c5c0c03df5145083d36b800759a058d8602ede (diff) | |
download | gerbolyze-e76d257220cb98cf8286b077cad248de62a6abc8.tar.gz gerbolyze-e76d257220cb98cf8286b077cad248de62a6abc8.tar.bz2 gerbolyze-e76d257220cb98cf8286b077cad248de62a6abc8.zip |
svg-flatten: fix failing testsv3.0.9
Diffstat (limited to 'svg-flatten/src/svg_path.cpp')
-rw-r--r-- | svg-flatten/src/svg_path.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/svg-flatten/src/svg_path.cpp b/svg-flatten/src/svg_path.cpp index f122626..71c7bd2 100644 --- a/svg-flatten/src/svg_path.cpp +++ b/svg-flatten/src/svg_path.cpp @@ -185,7 +185,6 @@ void gerbolyze::parse_dasharray(const pugi::xml_node &node, vector<double> &out) /* Take a Clipper path in clipper-scaled document units, and apply the given SVG dash array to it. Do this by walking * the path from start to end while emitting dashes. */ void gerbolyze::dash_path(const ClipperLib::Path &in, ClipperLib::Paths &out, const vector<double> dasharray, double dash_offset) { - out.clear(); if (dasharray.empty() || in.size() < 2) { out.push_back(in); return; @@ -225,6 +224,7 @@ void gerbolyze::dash_path(const ClipperLib::Path &in, ClipperLib::Paths &out, co /* end this dash */ current_dash.push_back(intermediate); if (dash_idx%2 == 0) { /* dash */ + //cerr << "dash of size " << current_dash.size() << " from " << (current_dash[0].X/clipper_scale) << ", " << (current_dash[0].Y/clipper_scale) << " to " << (current_dash.back().X/clipper_scale) << ", " << (current_dash.back().Y/clipper_scale) << endl; out.push_back(current_dash); } /* else space */ dash_idx = (dash_idx + 1) % num_dashes; @@ -246,6 +246,7 @@ void gerbolyze::dash_path(const ClipperLib::Path &in, ClipperLib::Paths &out, co /* end this dash */ current_dash.push_back(intermediate); if (dash_idx%2 == 0) { /* dash */ + //cerr << "dash of size " << current_dash.size() << " from " << (current_dash[0].X/clipper_scale) << ", " << (current_dash[0].Y/clipper_scale) << " to " << (current_dash.back().X/clipper_scale) << ", " << (current_dash.back().Y/clipper_scale) << endl; out.push_back(current_dash); } /* else space */ dash_idx = (dash_idx + 1) % num_dashes; @@ -262,7 +263,10 @@ void gerbolyze::dash_path(const ClipperLib::Path &in, ClipperLib::Paths &out, co /* Finish last dash */ if (current_dash.size() > 0 && (dash_idx%2 == 0)) { + //cerr << "dash of size " << current_dash.size() << " from " << (current_dash[0].X/clipper_scale) << ", " << (current_dash[0].Y/clipper_scale) << " to " << (current_dash.back().X/clipper_scale) << ", " << (current_dash.back().Y/clipper_scale) << endl; + out.push_back(current_dash); } + //cerr << "out now has " << out.size() << " elements" << endl; } |