From 17773c1d21bded8fe3f10f6a835dc11ea1910746 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Mon, 10 Feb 2014 06:24:25 -0500 Subject: Extensions->Render submenu. Scaling into document units for grid.cpp (Bug 1240455) (bzr r13018) --- src/extension/internal/grid.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index 2f9d0ff25..c2ef2b27c 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -112,11 +112,13 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc bounding_area = temprec; } - float spacings[2] = { module->get_param_float("xspacing"), - module->get_param_float("yspacing") }; - float line_width = module->get_param_float("lineWidth"); - float offsets[2] = { module->get_param_float("xoffset"), - module->get_param_float("yoffset") }; + gdouble scale = Inkscape::Util::Quantity::convert(1, "px", (document->doc())->getDefaultUnit()); + bounding_area *= Geom::Scale(scale); + float spacings[2] = { scale*module->get_param_float("xspacing"), + scale*module->get_param_float("yspacing") }; + float line_width = scale*module->get_param_float("lineWidth"); + float offsets[2] = { scale*module->get_param_float("xoffset"), + scale*module->get_param_float("yoffset") }; Glib::ustring path_data(""); -- cgit v1.2.3 From 3a206ec046a04b2d2adcff78918b1231ba086e8b Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 11 Feb 2014 11:55:10 +0100 Subject: Fix parsing of preserveAspectRatio broken in r13016. (bzr r13019) --- src/viewbox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/viewbox.cpp b/src/viewbox.cpp index e46fe005c..f59909abc 100644 --- a/src/viewbox.cpp +++ b/src/viewbox.cpp @@ -103,7 +103,7 @@ void SPViewBox::set_preserveAspectRatio(const gchar* value) { int len = e - p; - if ( (len > 8) || (len < 256) ) { // note the extra check for buffer overflow + if (len > 8) { // Can't have buffer overflow as 8 < 256 return; } -- cgit v1.2.3 From 1fcd3766d80f7ff8cc0fabc05c3923254ed86124 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 11 Feb 2014 12:35:04 +0100 Subject: Set 'preserveAspectRatio' to 'none' when importing an image. (bzr r13020) --- src/extension/internal/gdkpixbuf-input.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index d7d692091..ec04b1dad 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -95,6 +95,11 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) Inkscape::XML::Node *image_node = xml_doc->createElement("svg:image"); sp_repr_set_svg_double(image_node, "width", width); sp_repr_set_svg_double(image_node, "height", height); + + // Added 11 Feb 2014 as we now honor "preserveAspectRatio" and this is + // what Inkscaper's expect. + image_node->setAttribute("preserveAspectRatio", "none"); + if( scale.compare( "auto" ) != 0 ) { SPCSSAttr *css = sp_repr_css_attr_new(); sp_repr_css_set_property(css, "image-rendering", scale.c_str()); @@ -122,6 +127,7 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) // Set viewBox if it doesn't exist if (!doc->getRoot()->viewBox_set) { + std::cout << "Viewbox not set, setting" << std::endl; doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc->getDefaultUnit()), doc->getHeight().value(doc->getDefaultUnit()))); } -- cgit v1.2.3