From 7e6deb8548f27c82751fde2155046ec1a69dc5a0 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 30 Jul 2010 08:40:22 +0000 Subject: [PATCH] stuff --- TODO | 8 +++++++- libvips/iofuncs/im_open.c | 30 +++++++++++++++++++----------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/TODO b/TODO index edb6b9cf..447524f2 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,12 @@ - vipsthumbnail should use "rd" mode -- test "vips" rd open stuff +- we leak a region with + + vips --vips-progress im_copy wtc.jpg wtc.v + + how odd, also memuse is no lower ... we appear to open to memory, then copy + to temp disc, then copy to output disc + - lcms2 needs testing diff --git a/libvips/iofuncs/im_open.c b/libvips/iofuncs/im_open.c index 519eaae5..1c354458 100644 --- a/libvips/iofuncs/im_open.c +++ b/libvips/iofuncs/im_open.c @@ -127,8 +127,8 @@ Modified: */ /* -#define DEBUG */ +#define DEBUG #ifdef HAVE_CONFIG_H #include @@ -340,12 +340,12 @@ disc_threshold( void ) } } } - } #ifdef DEBUG - printf( "disc_threshold: parsed \"im__disc_threshold\" as %zd\n", - im__disc_threshold, threshold ); + printf( "disc_threshold: parsed \"%s\" as %zd\n", + im__disc_threshold, threshold ); #endif /*DEBUG*/ + } return( threshold ); } @@ -357,20 +357,28 @@ open_sub( VipsFormatClass *format, const char *filename, gboolean disc ) /* We open to disc if: * - 'disc' is set + * - disc_threshold() has not been set to zero * - the format does not support lazy read * - the image will be more than a megabyte, uncompressed */ im = NULL; - if( disc ) - if( !(vips_format_get_flags( format, filename ) & + if( disc && + disc_threshold() && + !(vips_format_get_flags( format, filename ) & VIPS_FORMAT_PARTIAL) ) { - size_t size; + size_t size; - size = guess_size( format, filename ); - if( size > disc_threshold() ) - if( !(im = im__open_temp( "%s.v" )) ) - return( NULL ); + size = guess_size( format, filename ); + if( size > disc_threshold() ) { + if( !(im = im__open_temp( "%s.v" )) ) + return( NULL ); + +#ifdef DEBUG + printf( "open_sub: opening to disc file \"%s\"\n", + im->filename ); +#endif /*DEBUG*/ } + } /* Otherwise, fall back to a "p". */