# LB 20230628: Added compatibility with older librsvg libraries diff -urp gegl-0.4.46.orig/operations/external/svg-load.c gegl-0.4.46/operations/external/svg-load.c --- gegl-0.4.46.orig/operations/external/svg-load.c 2023-06-26 00:49:19.000000000 +0200 +++ gegl-0.4.46/operations/external/svg-load.c 2023-06-28 17:59:18.718812273 +0200 @@ -76,16 +76,29 @@ query_svg (GeglOperation *operation) { GeglProperties *o = GEGL_PROPERTIES (operation); Priv *p = (Priv*) o->user_data; +#if LIBRSVG_CHECK_VERSION(2,51,0) gdouble out_width, out_height; +#else + RsvgDimensionData dimentions; +#endif g_return_val_if_fail (p->handle != NULL, FALSE); +#if LIBRSVG_CHECK_VERSION(2,51,0) rsvg_handle_get_intrinsic_size_in_pixels (p->handle, &out_width, &out_height); +#else + rsvg_handle_get_dimensions (p->handle, &dimentions); +#endif p->format = babl_format ("R'G'B'A u8"); +#if LIBRSVG_CHECK_VERSION(2,51,0) p->height = out_height; p->width = out_width; +#else + p->height = dimentions.height; + p->width = dimentions.width; +#endif return TRUE; } @@ -98,10 +111,12 @@ load_svg (GeglOperation *operation, { GeglProperties *o = GEGL_PROPERTIES (operation); Priv *p = (Priv*) o->user_data; - RsvgRectangle svg_rect = {0.0, 0.0, width, height}; cairo_surface_t *surface; cairo_t *cr; +#if LIBRSVG_CHECK_VERSION(2,45,90) + RsvgRectangle svg_rect = {0.0, 0.0, width, height}; GError *error = NULL; +#endif g_return_val_if_fail (p->handle != NULL, -1); @@ -115,7 +130,11 @@ load_svg (GeglOperation *operation, (double)height / (double)p->height); } +#if LIBRSVG_CHECK_VERSION(2,45,90) rsvg_handle_render_document (p->handle, cr, &svg_rect, &error); +#else + rsvg_handle_render_cairo (p->handle, cr); +#endif cairo_surface_flush (surface);