From 56e45545d3224195eb41b34b05bf38610e627c93 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 9 Feb 2016 11:58:43 +0000 Subject: [PATCH] fix load from buffer --- TODO | 8 +++++++- libvips/foreign/svgload.c | 22 ++++++++++++++++++++++ test/test_foreign.py | 1 - 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index 3dfb9d85..56a52e6a 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,10 @@ -- test suite is failing for svg load from buffer, strange +- make vips_foreign_load_svg_is_a_buffer() much faster + + test for first line starts "set_property = vips_object_set_property; @@ -388,6 +404,12 @@ vips_foreign_load_svg_buffer_class_init( object_class->nickname = "svgload_buffer"; object_class->description = _( "load SVG with rsvg" ); + /* is_a() is not quick, it must parse the whole document ... + * lower the priority. + */ + foreign_class->priority = -50; + + load_class->is_a_buffer = vips_foreign_load_svg_is_a_buffer; load_class->header = vips_foreign_load_svg_buffer_header; VIPS_ARG_BOXED( class, "buffer", 1, diff --git a/test/test_foreign.py b/test/test_foreign.py index 09a347b3..6672d190 100755 --- a/test/test_foreign.py +++ b/test/test_foreign.py @@ -371,7 +371,6 @@ class TestForeign(unittest.TestCase): return def svg_valid(self, im): - im.write_to_file("x.v") a = im(10, 10) self.assertAlmostEqualObjects(a, [0, 0, 77, 255]) self.assertEqual(im.width, 360)