From b2f66a39683258f9a6ea42157ebcf9073e524d32 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sun, 17 Sep 2017 05:20:48 +0100 Subject: [PATCH] add note on svgload improvement --- ChangeLog | 1 + libvips/foreign/svgload.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7fba46dd..02791143 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,7 @@ - remove python tests ... moved to pyvips test suite - vips7 and vips8 python bindings default to off ... use the new pyvips binding instead +- better svgload: larger output, handle missing width/height, thanks lovell 29/8/17 started 8.5.9 - make --fail stop jpeg read on any libjpeg warning, thanks @mceachen diff --git a/libvips/foreign/svgload.c b/libvips/foreign/svgload.c index dfd6f9f3..a19298fd 100644 --- a/libvips/foreign/svgload.c +++ b/libvips/foreign/svgload.c @@ -10,6 +10,8 @@ * - fix DPI mixup, thanks Fosk * 9/9/17 * - limit max tile width to 30k pixels to prevent overflow in render + * 17/9/17 lovell + * - handle scaling of svg files missing width and height attributes */ /* @@ -130,8 +132,7 @@ vips_foreign_load_svg_get_flags( VipsForeignLoad *load ) } static void -vips_foreign_load_svg_parse( VipsForeignLoadSvg *svg, - VipsImage *out ) +vips_foreign_load_svg_parse( VipsForeignLoadSvg *svg, VipsImage *out ) { RsvgDimensionData dimensions; int width; @@ -154,14 +155,16 @@ vips_foreign_load_svg_parse( VipsForeignLoadSvg *svg, rsvg_handle_get_dimensions( svg->page, &dimensions ); if( width == dimensions.width && height == dimensions.height ) { - /* SVG without width and height always reports same dimensions - * regardless of dpi. Apply dpi/scale using cairo instead. + /* SVG without width and height always reports the same + * dimensions regardless of dpi. Apply dpi/scale using + * cairo instead. */ svg->cairo_scale = scale; width = width * scale; height = height * scale; } else { - /* SVG with width and height reports correctly scaled dimensions. + /* SVG with width and height reports correctly scaled + * dimensions. */ width = dimensions.width; height = dimensions.height; @@ -516,7 +519,6 @@ vips_foreign_load_svg_is_a_buffer( const void *buf, size_t len ) for( i = 0; i < 24; i++ ) if( !isascii( str[i] ) ) return( FALSE ); - for( i = 0; i < 300 && i < len - 5; i++ ) if( g_ascii_strncasecmp( str + i, "