From: Krzysztof KosiƄski Date: Sat, 3 Apr 2010 16:50:12 +0000 (+0200) Subject: Fix grid extension X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=16d76d26e4fa5c295d19cc7544f9aeebd8325d76;p=inkscape.git Fix grid extension --- diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index d4b35b261..deef367a4 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -46,13 +46,12 @@ Grid::load (Inkscape::Extension::Extension */*module*/) namespace { -Glib::ustring build_lines(int axis, Geom::Rect bounding_area, - float offset, float spacing) +void build_lines(int axis, Geom::Rect bounding_area, float offset, + float spacing, SVG::PathString &path_data) { Geom::Point point_offset(0.0, 0.0); point_offset[axis] = offset; - SVG::PathString path_data; for (Geom::Point start_point = bounding_area.min(); start_point[axis] + offset <= (bounding_area.max())[axis]; start_point[axis] += spacing) { @@ -62,8 +61,6 @@ Glib::ustring build_lines(int axis, Geom::Rect bounding_area, path_data.moveTo(start_point + point_offset) .lineTo(end_point + point_offset); } - - return path_data; } } @@ -89,10 +86,8 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc if (bounds) { bounding_area = *bounds; } - - gdouble doc_height = sp_document_height(document->doc()); - Geom::Rect temprec = Geom::Rect(Geom::Point(bounding_area.min()[Geom::X], doc_height - bounding_area.min()[Geom::Y]), - Geom::Point(bounding_area.max()[Geom::X], doc_height - bounding_area.max()[Geom::Y])); + Geom::Rect temprec = Geom::Rect(Geom::Point(bounding_area.min()[Geom::X], bounding_area.min()[Geom::Y]), + Geom::Point(bounding_area.max()[Geom::X], bounding_area.max()[Geom::Y])); bounding_area = temprec; } @@ -103,10 +98,9 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc float offsets[2] = { module->get_param_float("xoffset"), module->get_param_float("yoffset") }; - Glib::ustring path_data(""); + SVG::PathString path_data; for ( int axis = 0 ; axis < 2 ; ++axis ) { - path_data += build_lines(axis, bounding_area, - offsets[axis], spacings[axis]); + build_lines(axis, bounding_area, offsets[axis], spacings[axis], path_data); } Inkscape::XML::Document * xml_doc = sp_document_repr_doc(document->doc());