(#371): rsvg-convert - Fix positioning of extracted elements when they are scaled

When using the -w / -h options to set the width/height of the image,
together with the -i option to set the id of the single element to
export from an SVG, the resulting object was positioned incorrectly.
We want the object's upper-left corner to be at (0, 0) in the
resulting image.

Fixes #371
parent 2ba147af
Pipeline #38829 failed with stages
in 22 minutes and 10 seconds
......@@ -456,6 +456,10 @@ main (int argc, char **argv)
cairo_fill (cr);
}
cairo_scale (cr,
scaled_width / unscaled_width,
scaled_height / unscaled_height);
if (export_lookup_id) {
RsvgPositionData pos;
......@@ -468,9 +472,6 @@ main (int argc, char **argv)
cairo_translate (cr, -pos.x, -pos.y);
}
cairo_scale (cr,
scaled_width / unscaled_width,
scaled_height / unscaled_height);
if (!rsvg_handle_render_cairo_sub (rsvg, cr, export_lookup_id)) {
g_printerr ("Could not render file %s\n", args[i]);
exit (1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment