avoid need to instanciate expensive svg_path_generator twice

This commit is contained in:
Dane Springmeyer 2015-02-10 12:16:01 -08:00
parent 4e5522756a
commit 2042ffd824
2 changed files with 2 additions and 3 deletions

View file

@ -25,6 +25,4 @@
#include <string>
using sink_type = std::back_insert_iterator<std::string>;
// TODO - try to collapse to just using `vertex_adapter`
template struct mapnik::svg::svg_path_generator<sink_type, mapnik::geometry_type>;
template struct mapnik::svg::svg_path_generator<sink_type, mapnik::vertex_adapter>;

View file

@ -40,7 +40,8 @@ inline bool to_svg(std::string & svg, mapnik::geometry_type const& geom)
{
using sink_type = std::back_insert_iterator<std::string>;
sink_type sink(svg);
static const svg::svg_path_generator<sink_type, mapnik::geometry_type> generator;
mapnik::vertex_adapter va(geom);
static const svg::svg_path_generator<sink_type, mapnik::vertex_adapter> generator;
bool result = karma::generate(sink, generator, geom);
return result;
}