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



commit 858a09a475e0dab53cb7afe04e88c726e696c0d4
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Oct 26 20:16:14 2018 -0500

    (#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 https://gitlab.gnome.org/GNOME/librsvg/issues/371

 rsvg-convert.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/rsvg-convert.c b/rsvg-convert.c
index fa2b9341..c615a709 100644
--- a/rsvg-convert.c
+++ b/rsvg-convert.c
@@ -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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]