summaryrefslogtreecommitdiff
path: root/src/generic
diff options
context:
space:
mode:
authorChristopher Michael <devilhorns@comcast.net>2021-09-21 09:35:34 -0400
committerChristopher Michael <devilhorns@comcast.net>2021-09-21 09:35:34 -0400
commitcbcf5bc64a90306c82f0eb99ae43b5f52c122f71 (patch)
tree72eb4bd6e99ce415d5d63dce5f3424e04969b352 /src/generic
parent66dcdf6b70497df6270418c0f745cc3d17568e9b (diff)
downloadefl-cbcf5bc64a90306c82f0eb99ae43b5f52c122f71.tar.gz
evas-rsvg: Update rsvg code to not use deprecated functions
A few of the functions used in this code have been deprecated in the latest librsvg. This patch fixes the deprecated warnings by using possible. NB: As I am no cairo expert, someone may want to check that the proper dimensions are used in read_svg_data function. I was not sure if this should be using the 'scaled' dimensions or not.
Diffstat (limited to 'src/generic')
-rw-r--r--src/generic/evas/rsvg/main.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/generic/evas/rsvg/main.c b/src/generic/evas/rsvg/main.c
index d13aa5ffff..309539ccd2 100644
--- a/src/generic/evas/rsvg/main.c
+++ b/src/generic/evas/rsvg/main.c
@@ -98,9 +98,18 @@ static int
read_svg_header(int scale_down, double dpi, int size_w, int size_h)
{
rsvg_handle_set_dpi(rsvg, 75.0);
+
+#ifndef HAVE_SVG_2_36
rsvg_handle_get_dimensions(rsvg, &dim);
width = dim.width;
height = dim.height;
+#else
+ double owidth, oheight;
+
+ rsvg_handle_get_intrinsic_size_in_pixels(rsvg, &owidth, &oheight);
+ width = ceil(owidth);
+ height = ceil(oheight);
+#endif
if ((width < 1) || (height < 1)) return 0;
@@ -152,7 +161,21 @@ read_svg_data(void)
if (!cr) return 0;
cairo_scale(cr, (double) width / dim.em, (double) height / dim.ex);
+
+#ifndef HAVE_SVG_2_36
rsvg_handle_render_cairo(rsvg, cr);
+#else
+ RsvgRectangle vp =
+ {
+ .x = 0,
+ .y = 0,
+ .width = width,
+ .height = height,
+ };
+
+ rsvg_handle_render_document(rsvg, cr, &vp, NULL);
+#endif
+
cairo_surface_destroy(surface);
cairo_destroy(cr);