[Commits] [SCM] claws branch, gtk2, updated. 3.20.0-17-g6d873861f
mones at claws-mail.org
mones at claws-mail.org
Thu Dec 28 12:10:14 UTC 2023
The branch, gtk2 has been updated
via 6d873861fd0b7db1542e48c0f7c50a3a1e506d43 (commit)
from 224a63eca7481754d63e0b97043fa86888e40177 (commit)
Summary of changes:
src/stock_pixmap.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
- Log -----------------------------------------------------------------
commit 6d873861fd0b7db1542e48c0f7c50a3a1e506d43
Author: Ricardo Mones <ricardo at mones.org>
Date: Thu Dec 28 13:09:12 2023 +0100
Don't use deprecated calls with modern SVG library
Removes the following warnings:
• stock_pixmap.c:545:9: warning: ‘rsvg_handle_get_dimensions’ is
deprecated: Use 'rsvg_handle_get_intrinsic_size_in_pixels' instead
• stock_pixmap.c:554:9: warning: ‘rsvg_handle_render_cairo’ is deprecated:
Use 'rsvg_handle_render_document' instead
• stock_pixmap.c:675:17: warning: ‘rsvg_handle_get_dimensions’ is
deprecated: Use 'rsvg_handle_get_intrinsic_size_in_pixels' instead
diff --git a/src/stock_pixmap.c b/src/stock_pixmap.c
index 6231e12e6..86cda6c05 100644
--- a/src/stock_pixmap.c
+++ b/src/stock_pixmap.c
@@ -542,6 +542,26 @@ GtkWidget *stock_pixmap_widget(StockPixmap icon)
*/
void render_scaled_proportionally(RsvgHandle *handle, cairo_t *cr, int width, int height)
{
+#if LIBRSVG_CHECK_VERSION(2, 46, 0)
+ if (cairo_status(cr) == CAIRO_STATUS_SUCCESS) {
+ const RsvgRectangle viewport = {
+ .x = 0,
+ .y = 0,
+ .width = width,
+ .height = height,
+ };
+ GError *err = NULL;
+
+ cairo_rectangle(cr, 0, 0, width, height);
+ cairo_clip(cr);
+
+ rsvg_handle_render_document(handle, cr, &viewport, &err);
+ if (err != NULL) {
+ g_warning("unable to render SVG document (%d): %s", err->code, err->message);
+ g_error_free(err);
+ }
+ }
+#else
RsvgDimensionData dimensions;
double x_factor, y_factor;
double scale_factor;
@@ -556,6 +576,7 @@ void render_scaled_proportionally(RsvgHandle *handle, cairo_t *cr, int width, in
cairo_scale(cr, scale_factor, scale_factor);
rsvg_handle_render_cairo(handle, cr);
+#endif
}
/*
@@ -674,11 +695,19 @@ GdkPixbuf *pixbuf_from_svg_like_icon(char *filename, GError **error, StockPixmap
height = (int) floor(factor * height);
}
} else { /* render using SVG size */
+#if LIBRSVG_CHECK_VERSION(2, 46, 0)
+ double svg_width, svg_height;
+
+ rsvg_handle_get_intrinsic_size_in_pixels(handle, &svg_width, &svg_height);
+ width = (int) svg_width;
+ height = (int) svg_height;
+#else
RsvgDimensionData dimension;
rsvg_handle_get_dimensions (handle, &dimension);
width = dimension.width;
height = dimension.height;
+#endif
}
/* create drawing context */
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list