From 61e419a992a054c4417444f6f190a8efbba4bfba Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 1 Jun 2016 20:39:05 +0200 Subject: Replace two instances of getSVGUnit() by getDocumentScale(). Simplify writing of style string. Switch 'pt' to 'px'. (bzr r14938) --- src/extension/plugins/grid2/grid.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/extension/plugins/grid2/grid.cpp') diff --git a/src/extension/plugins/grid2/grid.cpp b/src/extension/plugins/grid2/grid.cpp index 3a2ed7867..6880c574d 100644 --- a/src/extension/plugins/grid2/grid.cpp +++ b/src/extension/plugins/grid2/grid.cpp @@ -114,7 +114,8 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc bounding_area = temprec; } - gdouble scale = Inkscape::Util::Quantity::convert(1, "px", &document->doc()->getSVGUnit()); + double scale = document->doc()->getDocumentScale().inverse()[Geom::X]; + bounding_area *= Geom::Scale(scale); Geom::Point spacings( scale * module->get_param_float("xspacing"), scale * module->get_param_float("yspacing") ); @@ -133,15 +134,9 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc path->setAttribute("d", path_data.c_str()); - Glib::ustring style("fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"); - style += ";stroke-width:"; - gchar floatstring[64]; std::ostringstream stringstream; - stringstream << line_width; - sprintf(floatstring, "%s", stringstream.str().c_str()); - style += floatstring; - style += "pt"; - path->setAttribute("style", style.c_str()); + stringstream << "fill:none;stroke:#000000;stroke-width:" << line_width << "px"; + path->setAttribute("style", stringstream.str().c_str()); current_layer->appendChild(path); Inkscape::GC::release(path); -- cgit v1.2.3