Skip to content
Myr

render: use rsvg_handle_render_document() instead of rsvg_handle_render_cairo()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

rsvg_handle_render_cairo() is deprecated, use rsvg_handle_render_document() instead. However, FreeBSD seems to be stuck on a librsvg-2.40, where rsvg_handle_render_document() doesn’t exist (it was added in 2.46). Thus, keep the old code, and is it when compiling against older librsvg versions, and use rsvg_handle_render_document() on 2.46 and up. Closes #32

authored by Daniel Eklöf · committed by Daniel Eklöf · parent 050bb60 · Browse files · 2 files+30 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+30 added−0 removed

  • other:+30 added−0 removed

2 files+30 added−0 removed

modified:CHANGELOG.md+6 added
modified:render.c+24 added
334 unmodified lines
335336 cairo_rectangle(buf->cairo, img_x, img_y, height, width);337 cairo_clip(buf->cairo);338339#if LIBRSVG_CHECK_VERSION(2, 46, 0)340 if (cairo_status(buf->cairo) == CAIRO_STATUS_SUCCESS) {341 RsvgRectangle viewport = {342 .x = img_x,343 .y = img_y,344 .width = width,345 .height = height,346 };347 rsvg_handle_render_document(svg, buf->cairo, &viewport, NULL);348 }349#else350 /* Translate + scale. Note: order matters! */351 cairo_translate(buf->cairo, img_x, img_y);352 cairo_scale(buf->cairo, scale, scale);353354 if (cairo_status(buf->cairo) == CAIRO_STATUS_SUCCESS)355 rsvg_handle_render_cairo(svg, buf->cairo);356#endif357 cairo_restore(buf->cairo);358 }359#endif /* FUZZEL_ENABLE_SVG */360 }
105 unmodified lines
466467 cairo_rectangle(buf->cairo, img_x, img_y, img_width, img_height);468 cairo_clip(buf->cairo);469470#if LIBRSVG_CHECK_VERSION(2, 46, 0)471 if (cairo_status(buf->cairo) == CAIRO_STATUS_SUCCESS) {472 RsvgRectangle viewport = {473 .x = cur_x,474 .y = first_row + i * row_height + (row_height - height) / 2,475 .width = img_width,476 .height = img_height,477 };478 rsvg_handle_render_document(icon->svg, buf->cairo, &viewport, NULL);479 }480#else481 /* Translate + scale. Note: order matters! */482 cairo_translate(483 buf->cairo, cur_x,484 first_row + i * row_height + (row_height - height) / 2);485 cairo_scale(buf->cairo, scale, scale);486487 if (cairo_status(buf->cairo) == CAIRO_STATUS_SUCCESS)488 rsvg_handle_render_cairo(icon->svg, buf->cairo);489#endif490 cairo_restore(buf->cairo);491#endif /* FUZZEL_ENABLE_SVG */492 break;493 }
117 unmodified lines