diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2014-02-11 11:39:53 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2014-02-11 11:39:53 +0000 |
| commit | 4c52ed01caef79ee62c965ac22bbfffa4d42b375 (patch) | |
| tree | 365def34a47a37c232927b21ca2933955e7c22e1 | |
| parent | update to trunk (diff) | |
| parent | Set 'preserveAspectRatio' to 'none' when importing an image. (diff) | |
| download | inkscape-4c52ed01caef79ee62c965ac22bbfffa4d42b375.tar.gz inkscape-4c52ed01caef79ee62c965ac22bbfffa4d42b375.zip | |
update to trunk
(bzr r11950.1.253)
| -rw-r--r-- | src/extension/internal/gdkpixbuf-input.cpp | 6 | ||||
| -rw-r--r-- | src/extension/internal/grid.cpp | 12 | ||||
| -rw-r--r-- | src/viewbox.cpp | 2 |
3 files changed, 14 insertions, 6 deletions
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()))); } 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(""); 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; } |
