[vlc-commits] [Git][videolan/vlc][master] svg: replace deprecated rsvg_handle_get_dimensions
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Fri Dec 12 20:43:04 UTC 2025
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
5512290f by Abderhman Gamal at 2025-12-12T21:42:49+01:00
svg: replace deprecated rsvg_handle_get_dimensions
- - - - -
2 changed files:
- modules/codec/svg.c
- modules/text_renderer/svg.c
Changes:
=====================================
modules/codec/svg.c
=====================================
@@ -148,8 +148,31 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
goto done;
RsvgDimensionData dim;
+ #if LIBRSVG_MAJOR_VERSION > 2 || ( LIBRSVG_MAJOR_VERSION == 2 && LIBRSVG_MINOR_VERSION >= 52 )
+ gboolean has_width, has_height, has_viewbox;
+ RsvgLength width, height;
+ RsvgRectangle viewbox;
+
+ rsvg_handle_get_intrinsic_dimensions( rsvg, &has_width, &width, &has_height, &height, &has_viewbox, &viewbox );
+
+ if( has_width && has_height && width.unit == RSVG_UNIT_PX && height.unit == RSVG_UNIT_PX )
+ {
+ dim.width = (int) width.length;
+ dim.height = (int) height.length;
+ }
+ else if( has_viewbox )
+ {
+ dim.width = (int) viewbox.width;
+ dim.height = (int) viewbox.height;
+ }
+ else
+ {
+ dim.width = 0;
+ dim.height = 0;
+ }
+ #else
rsvg_handle_get_dimensions( rsvg, &dim );
-
+ #endif
if( p_sys->f_scale > 0.0 )
{
i_width = (int32_t)(p_sys->f_scale * dim.width);
=====================================
modules/text_renderer/svg.c
=====================================
@@ -243,7 +243,31 @@ static picture_t * svg_RenderPicture( filter_t *p_filter,
}
RsvgDimensionData dim;
+ #if LIBRSVG_MAJOR_VERSION > 2 || ( LIBRSVG_MAJOR_VERSION == 2 && LIBRSVG_MINOR_VERSION >= 52 )
+ gboolean has_width, has_height, has_viewbox;
+ RsvgLength width, height;
+ RsvgRectangle viewbox;
+
+ rsvg_handle_get_intrinsic_dimensions( p_handle, &has_width, &width, &has_height, &height, &has_viewbox, &viewbox );
+
+ if( has_width && has_height && width.unit == RSVG_UNIT_PX && height.unit == RSVG_UNIT_PX )
+ {
+ dim.width = (int) width.length;
+ dim.height = (int) height.length;
+ }
+ else if( has_viewbox )
+ {
+ dim.width = (int) viewbox.width;
+ dim.height = (int) viewbox.height;
+ }
+ else
+ {
+ dim.width = 0;
+ dim.height = 0;
+ }
+ #else
rsvg_handle_get_dimensions( p_handle, &dim );
+ #endif
float scale;
svg_RescaletoFit( p_filter, &dim.width, &dim.height, &scale );
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/5512290f5e7848700a97e18233ffe5ab0ff5aacf
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/5512290f5e7848700a97e18233ffe5ab0ff5aacf
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list