Fix compatibility with newer resvg versions

This commit is contained in:
Přemysl Eric Janouch 2023-06-28 18:01:15 +02:00
parent 6ee5f69bfe
commit f05e66bfc1
Signed by: p
GPG Key ID: A0420B94F92B9493

View File

@ -2291,11 +2291,16 @@ load_resvg_render_internal(FivIoRenderClosureResvg *self,
} }
uint32_t *pixels = (uint32_t *) image->data; uint32_t *pixels = (uint32_t *) image->data;
#if RESVG_MAJOR_VERSION == 0 && RESVG_MINOR_VERSION < 33
resvg_fit_to fit_to = { resvg_fit_to fit_to = {
scale == 1 ? RESVG_FIT_TO_TYPE_ORIGINAL : RESVG_FIT_TO_TYPE_ZOOM, scale == 1 ? RESVG_FIT_TO_TYPE_ORIGINAL : RESVG_FIT_TO_TYPE_ZOOM,
scale}; scale};
resvg_render(self->tree, fit_to, resvg_transform_identity(), resvg_render(self->tree, fit_to, resvg_transform_identity(),
image->width, image->height, (char *) pixels); image->width, image->height, (char *) pixels);
#else
resvg_render(self->tree, (resvg_transform) {.a = scale, .d = scale},
image->width, image->height, (char *) pixels);
#endif
for (int i = 0; i < w * h; i++) { for (int i = 0; i < w * h; i++) {
uint32_t rgba = g_ntohl(pixels[i]); uint32_t rgba = g_ntohl(pixels[i]);