diff options
author | jaseg <git@jaseg.de> | 2021-04-25 00:09:57 +0200 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2021-04-25 00:20:51 +0200 |
commit | 1180ebdc1f18044a74f22f17b4d500ce7d6543fa (patch) | |
tree | d2de84bc7b73feaae3d2a3b191e97531a1a9dd32 /svg-flatten/src/svg_geom.cpp | |
parent | 776e0bd2069af0cfff7ce794cf3b345b613e1c02 (diff) | |
download | gerbolyze-1180ebdc1f18044a74f22f17b4d500ce7d6543fa.tar.gz gerbolyze-1180ebdc1f18044a74f22f17b4d500ce7d6543fa.tar.bz2 gerbolyze-1180ebdc1f18044a74f22f17b4d500ce7d6543fa.zip |
Remove cairo dependencywip-nocairo
We initially used Cairo for its bezier flattening algorithm. That
algorithm turned out to be a bit too imprecise at the scales we're
working at here (#17), so I ended up porting over some code from
Antigrain Graphics. The only other thing we used Cairo for was debug
output and coordinate transforms, so I just wrote the relevant vector
math in a small header file, deleted all debug output code and thus
eliminated the cairo dependency. This is a step towards Windows builds.
Diffstat (limited to 'svg-flatten/src/svg_geom.cpp')
-rw-r--r-- | svg-flatten/src/svg_geom.cpp | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/svg-flatten/src/svg_geom.cpp b/svg-flatten/src/svg_geom.cpp index 0ca66fe..f836567 100644 --- a/svg-flatten/src/svg_geom.cpp +++ b/svg-flatten/src/svg_geom.cpp @@ -24,7 +24,6 @@ #include <sstream> #include <queue> #include <assert.h> -#include <cairo.h> #include "svg_import_defs.h" using namespace ClipperLib; @@ -159,24 +158,3 @@ void gerbolyze::combine_clip_paths(Paths &in_a, Paths &in_b, Paths &out) { c.Execute(ctIntersection, out, pftNonZero); } -/* Transform given clipper paths under the given cairo transform. If no transform is given, use cairo's current - * user-to-device transform. */ -void gerbolyze::transform_paths(cairo_t *cr, Paths &paths, cairo_matrix_t *mat) { - cairo_save(cr); - if (mat != nullptr) { - cairo_set_matrix(cr, mat); - } - - for (Path &p : paths) { - transform(p.begin(), p.end(), p.begin(), - [cr](IntPoint p) -> IntPoint { - double x = p.X / clipper_scale, y = p.Y / clipper_scale; - cairo_user_to_device(cr, &x, &y); - return { (cInt)round(x * clipper_scale), (cInt)round(y * clipper_scale) }; - }); - } - - cairo_restore(cr); -} - - |