Accepting request 390546 from GNOME:Next
1 OBS-URL: https://build.opensuse.org/request/show/390546 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/librsvg?expand=0&rev=101
This commit is contained in:
parent
099b87f6c5
commit
ec378d79e4
105
librsvg-Fix-rsvg-convert.patch
Normal file
105
librsvg-Fix-rsvg-convert.patch
Normal file
@ -0,0 +1,105 @@
|
||||
From 7db196eae60cc0dbbe3a262429bfecac3936c5b9 Mon Sep 17 00:00:00 2001
|
||||
From: Menner <mik@gmx.org>
|
||||
Date: Mon, 4 Apr 2016 13:15:44 -0500
|
||||
Subject: bgo#760262: rsvg-convert: Actually scale the image if required
|
||||
|
||||
Commit fecfcce44a959daff80a4e0f9ced83d7cdcb5903 removed a call to the deprecated function
|
||||
rsvg_handle_set_size_callback(), but this is what actually made the program scale
|
||||
the resulting image if required. Here we use a Cairo transformation matrix instead.
|
||||
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=760262
|
||||
|
||||
Based on a patch by Menner <mik@gmx.org>
|
||||
---
|
||||
rsvg-convert.c | 24 +++++++++++++++++-------
|
||||
1 file changed, 17 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/rsvg-convert.c b/rsvg-convert.c
|
||||
index 2befdff..1e3ed05 100644
|
||||
--- a/rsvg-convert.c
|
||||
+++ b/rsvg-convert.c
|
||||
@@ -140,6 +140,8 @@ main (int argc, char **argv)
|
||||
RsvgDimensionData dimensions;
|
||||
FILE *output_file = stdout;
|
||||
char *export_lookup_id;
|
||||
+ double unscaled_width, unscaled_height;
|
||||
+ int scaled_width, scaled_height;
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
HANDLE handle;
|
||||
@@ -319,6 +321,9 @@ main (int argc, char **argv)
|
||||
if (!rsvg_handle_get_dimensions_sub (rsvg, &dimensions, export_lookup_id))
|
||||
g_printerr ("Could not get dimensions for file %s\n", args[i]);
|
||||
|
||||
+ unscaled_width = dimensions.width;
|
||||
+ unscaled_height = dimensions.height;
|
||||
+
|
||||
/* if both are unspecified, assume user wants to zoom the image in at least 1 dimension */
|
||||
if (width == -1 && height == -1) {
|
||||
size_data.type = RSVG_SIZE_ZOOM;
|
||||
@@ -348,20 +353,22 @@ main (int argc, char **argv)
|
||||
size_data.keep_aspect_ratio = keep_aspect_ratio;
|
||||
}
|
||||
|
||||
- _rsvg_size_callback (&dimensions.width, &dimensions.height, &size_data);
|
||||
+ scaled_width = dimensions.width;
|
||||
+ scaled_height = dimensions.height;
|
||||
+ _rsvg_size_callback (&scaled_width, &scaled_height, &size_data);
|
||||
|
||||
if (!format || !strcmp (format, "png"))
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
|
||||
- dimensions.width, dimensions.height);
|
||||
+ scaled_width, scaled_height);
|
||||
#ifdef CAIRO_HAS_PDF_SURFACE
|
||||
else if (!strcmp (format, "pdf"))
|
||||
surface = cairo_pdf_surface_create_for_stream (rsvg_cairo_write_func, output_file,
|
||||
- dimensions.width, dimensions.height);
|
||||
+ scaled_width, scaled_height);
|
||||
#endif
|
||||
#ifdef CAIRO_HAS_PS_SURFACE
|
||||
else if (!strcmp (format, "ps") || !strcmp (format, "eps")){
|
||||
surface = cairo_ps_surface_create_for_stream (rsvg_cairo_write_func, output_file,
|
||||
- dimensions.width, dimensions.height);
|
||||
+ scaled_width, scaled_height);
|
||||
if(!strcmp (format, "eps"))
|
||||
cairo_ps_surface_set_eps(surface, TRUE);
|
||||
}
|
||||
@@ -369,13 +376,13 @@ main (int argc, char **argv)
|
||||
#ifdef CAIRO_HAS_SVG_SURFACE
|
||||
else if (!strcmp (format, "svg"))
|
||||
surface = cairo_svg_surface_create_for_stream (rsvg_cairo_write_func, output_file,
|
||||
- dimensions.width, dimensions.height);
|
||||
+ scaled_width, scaled_height);
|
||||
#endif
|
||||
#ifdef CAIRO_HAS_XML_SURFACE
|
||||
else if (!strcmp (format, "xml")) {
|
||||
cairo_device_t *device = cairo_xml_create_for_stream (rsvg_cairo_write_func, output_file);
|
||||
surface = cairo_xml_surface_create (device, CAIRO_CONTENT_COLOR_ALPHA,
|
||||
- dimensions.width, dimensions.height);
|
||||
+ scaled_width, scaled_height);
|
||||
cairo_device_destroy (device);
|
||||
}
|
||||
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE (1, 10, 0)
|
||||
@@ -400,7 +407,7 @@ main (int argc, char **argv)
|
||||
((background_color >> 16) & 0xff) / 255.0,
|
||||
((background_color >> 8) & 0xff) / 255.0,
|
||||
((background_color >> 0) & 0xff) / 255.0);
|
||||
- cairo_rectangle (cr, 0, 0, dimensions.width, dimensions.height);
|
||||
+ cairo_rectangle (cr, 0, 0, scaled_width, scaled_height);
|
||||
cairo_fill (cr);
|
||||
}
|
||||
|
||||
@@ -416,6 +423,9 @@ main (int argc, char **argv)
|
||||
cairo_translate (cr, -pos.x, -pos.y);
|
||||
}
|
||||
|
||||
+ cairo_scale (cr,
|
||||
+ scaled_width / unscaled_width,
|
||||
+ scaled_height / unscaled_height);
|
||||
rsvg_handle_render_cairo_sub (rsvg, cr, export_lookup_id);
|
||||
|
||||
g_free (export_lookup_id);
|
||||
--
|
||||
cgit v0.12
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Apr 18 11:18:56 UTC 2016 - zaitor@opensuse.org
|
||||
|
||||
- Add librsvg-Fix-rsvg-convert.patch: Actually scale the image if
|
||||
required, regression fix from upstream git (bgo#760262).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Apr 2 09:58:17 UTC 2016 - zaitor@opensuse.org
|
||||
|
||||
|
@ -25,6 +25,8 @@ Group: System/Libraries
|
||||
Url: http://librsvg.sourceforge.net/
|
||||
Source: http://download.gnome.org/sources/librsvg/2.40/%{name}-%{version}.tar.xz
|
||||
Source99: baselibs.conf
|
||||
# PATCH-FIX-UPSTREAM librsvg-Fix-rsvg-convert.patch bgo#760262 zaitor@opensuse.org -- Actually scale the image if required, regression fix.
|
||||
Patch0: librsvg-Fix-rsvg-convert.patch
|
||||
BuildRequires: gobject-introspection-devel
|
||||
BuildRequires: vala
|
||||
# Avoid cycle: we do not require the adwaita-icon-theme to be present. libgtk-3.0 requires this for end users
|
||||
@ -120,6 +122,7 @@ http://www.w3c.org).
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
%configure\
|
||||
|
Loading…
Reference in New Issue
Block a user