Skip to content

Commit

Permalink
SVG: set default width/height if absent
Browse files Browse the repository at this point in the history
In the librsvg API calls for >=2.52, the newer API of
handle_get_intrinsic_size_in_pixels() doesn't set the default
width/height of the image if none is supplied.

In this case, set those to a default value of 16.0 for both width and
height.

Fixes #1133
  • Loading branch information
ThomasAdam committed Dec 7, 2024
1 parent efef84c commit 03bf462
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion libs/PictureImageLoader.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,15 @@ Bool PImageLoadSvg(FIMAGE_CMD_ARGS)
double ddw, ddh;
RsvgLength out_w, out_h;

rsvg_handle_get_intrinsic_size_in_pixels(rsvg, &ddw, &ddh);
if (!rsvg_handle_get_intrinsic_size_in_pixels(rsvg, &ddw, &ddh)) {
/* The SVG image didn't set an explicit width/height. In this
* case, default to 16.0/16.0 for the width/height.
*
* This is the typical size for a small SVG icon.
*/
ddw = 16.0;
ddh = 16.0;
}
dim.width = ddw;
dim.height = ddh;

Expand Down

0 comments on commit 03bf462

Please sign in to comment.