diff --git a/src/tuxpaint.c b/src/tuxpaint.c index b38dbce3e..82151dcf7 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - June 14, 2002 - June 19, 2023 + June 14, 2002 - June 21, 2023 */ #include "platform.h" @@ -20941,7 +20941,6 @@ static SDL_Surface *_load_svg(const char *file) RsvgHandle *rsvg_handle; GError *gerr; unsigned char *image; - gdouble d_rwidth, d_rheight; int rwidth, rheight; int width, height, stride; float scale; @@ -20963,11 +20962,31 @@ static SDL_Surface *_load_svg(const char *file) return (NULL); } - rsvg_handle_get_intrinsic_size_in_pixels(rsvg_handle, &d_rwidth, &d_rheight); - rwidth = (int) d_rwidth; - rheight = (int) d_rheight; +/* rsvg_handle_get_dimensions() is deprecated since since version 2.52, + but we currently support some platforms where it's not yet available + (e.g., Rocky Linux 9) */ +#if LIBRSVG_MAJOR_VERSION < 2 || LIBRSVG_MINOR_VERSION < 52 + { + RsvgDimensionData dim; + + rsvg_handle_get_dimensions(rsvg_handle, &dim); + rwidth = dim.width; + rheight = dim.height; + + DEBUG_PRINTF("SVG is %d x %d\n", rwidth, rheight); + } +#else + { + gdouble d_rwidth, d_rheight; + + rsvg_handle_get_intrinsic_size_in_pixels(rsvg_handle, &d_rwidth, &d_rheight); + rwidth = (int) d_rwidth; + rheight = (int) d_rheight; + + DEBUG_PRINTF("SVG is %f x %f (%d x %d)\n", d_rwidth, d_rheight, rwidth, rheight); + } +#endif - DEBUG_PRINTF("SVG is %f x %f (%d x %d)\n", d_rwidth, d_rheight, rwidth, rheight); /* Pick best scale to render to (for the canvas in this instance of Tux Paint) */