aboutsummaryrefslogtreecommitdiff
path: root/svg-flatten/src/svg_doc.cpp
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2022-06-21 16:23:09 +0200
committerjaseg <git@jaseg.de>2022-06-21 16:23:09 +0200
commite76d257220cb98cf8286b077cad248de62a6abc8 (patch)
tree16c3285f8c2f7a3818552f1fd2851dc032f2f7c2 /svg-flatten/src/svg_doc.cpp
parent29c5c0c03df5145083d36b800759a058d8602ede (diff)
downloadgerbolyze-e76d257220cb98cf8286b077cad248de62a6abc8.tar.gz
gerbolyze-e76d257220cb98cf8286b077cad248de62a6abc8.tar.bz2
gerbolyze-e76d257220cb98cf8286b077cad248de62a6abc8.zip
svg-flatten: fix failing testsv3.0.9
Diffstat (limited to 'svg-flatten/src/svg_doc.cpp')
-rw-r--r--svg-flatten/src/svg_doc.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/svg-flatten/src/svg_doc.cpp b/svg-flatten/src/svg_doc.cpp
index 1999876..3d02741 100644
--- a/svg-flatten/src/svg_doc.cpp
+++ b/svg-flatten/src/svg_doc.cpp
@@ -365,14 +365,19 @@ void gerbolyze::SVGDocument::export_svg_path(RenderContext &ctx, const pugi::xml
/* Calculate out dashes: A closed path becomes a number of open paths when it is dashed. */
if (!dasharray.empty()) {
- for (auto &poly : stroke_closed) {
- if (poly.empty()) {
- continue;
- }
+ auto open_copy(stroke_open);
+ stroke_open.clear();
+ for (auto &poly : stroke_closed) {
poly.push_back(poly[0]);
dash_path(poly, stroke_open, dasharray, stroke_dashoffset);
}
+
+ stroke_closed.clear();
+
+ for (auto &poly : open_copy) {
+ dash_path(poly, stroke_open, dasharray, stroke_dashoffset);
+ }
}
if (stroke_color != GRB_PATTERN_FILL) {
@@ -420,7 +425,7 @@ void gerbolyze::SVGDocument::export_svg_path(RenderContext &ctx, const pugi::xml
// cerr << " ends_can_be_mapped = " << ends_can_be_mapped << endl;
// cerr << " joins_can_be_mapped = " << joins_can_be_mapped << endl;
/* Accept loss of precision in outline mode. */
- if (ctx.settings().outline_mode || gerber_lossless ) {
+ if (ctx.sink().can_do_apertures() && (ctx.settings().outline_mode || gerber_lossless )) {
// cerr << " -> converting directly" << endl;
ctx.sink() << ApertureToken(stroke_width);
for (auto &path : stroke_closed) {
@@ -442,6 +447,7 @@ void gerbolyze::SVGDocument::export_svg_path(RenderContext &ctx, const pugi::xml
offx.ArcTolerance = 0.01 * clipper_scale; /* 10µm; TODO: Make this configurable */
offx.MiterLimit = stroke_miterlimit;
+ //cerr << "offsetting " << stroke_closed.size() << " closed and " << stroke_open.size() << " open paths" << endl;
/* For stroking we have to separately handle open and closed paths since coincident start and end points may
* render differently than joined start and end points. */
offx.AddPaths(stroke_closed, join_type, etClosedLine);