From 25a7b760d05e5fc2fa84917a8556e831fd39d315 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 26 Feb 2013 13:32:40 +0000 Subject: [PATCH] neater "header" output --- ChangeLog | 2 ++ TODO | 16 ---------------- libvips/conversion/tilecache.c | 25 +++++++++++++++---------- libvips/include/vips/object.h | 4 +++- libvips/iofuncs/image.c | 5 +++-- libvips/iofuncs/object.c | 5 ++--- 6 files changed, 25 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index d4621ae2..b0a82bbb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 22/1/13 started 7.32.0 - tilecache in threaded mode could deadlock if the downstream pixel source raised an error (thanks Todd) +- fix another dzsave corner-case (thanks Martin) +- neater output for "header" 31/8/12 started 7.31.0 - redone im_Lab2XYZ(), im_XYZ2Lab(), im_Lab2LCh(), im_LCh2Lab(), im_UCS2LCh, diff --git a/TODO b/TODO index c019e346..9ece20c6 100644 --- a/TODO +++ b/TODO @@ -1,19 +1,3 @@ -- on tilecache region error, black out the dead tile and issue a warning, - don't pass the error up the chain - - issue a warning too - -- fix - - $ header test.v - test.v: 14016x16448 uchar, 3 bands, srgb, openin VipsImage (0x907060) - - the ", openin VipsImage (0x907060)" is annoying and useless - - some hint about the image format might be useful perhaps? - - - - look at diff --git a/libvips/conversion/tilecache.c b/libvips/conversion/tilecache.c index 23746c30..5ab686cf 100644 --- a/libvips/conversion/tilecache.c +++ b/libvips/conversion/tilecache.c @@ -569,6 +569,7 @@ vips_tile_cache_gen( VipsRegion *or, { VipsRegion *in = (VipsRegion *) seq; VipsBlockCache *cache = (VipsBlockCache *) b; + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( cache ); VipsRect *r = &or->valid; VipsTile *tile; @@ -641,21 +642,25 @@ vips_tile_cache_gen( VipsRegion *or, if( cache->threaded ) g_mutex_lock( cache->lock ); + /* If there was an error calculating this + * tile, just warn and carry on. + * + * This can happen with things like reading + * .scn files via openslide. We don't want the + * read to fail because of one broken tile. + */ if( result ) { VIPS_DEBUG_MSG( "vips_tile_cache_gen: " "error on tile %p\n", tile ); - tile->state = VIPS_TILE_STATE_PEND; - vips_tile_cache_unref( work ); - /* Someone might have blocked when - * this tile was a CALC. It's now a - * PEND again, so they must wake up. - */ - g_cond_broadcast( cache->new_tile ); + vips_warn( class->nickname, + _( "error reading tile %dx%d: " + "%s" ), + tile->pos.left, tile->pos.top, + vips_error_buffer() ); + vips_error_clear(); - g_mutex_unlock( cache->lock ); - - return( -1 ); + vips_region_black( tile->region ); } tile->state = VIPS_TILE_STATE_DATA; diff --git a/libvips/include/vips/object.h b/libvips/include/vips/object.h index 71d16a4c..e2ae5561 100644 --- a/libvips/include/vips/object.h +++ b/libvips/include/vips/object.h @@ -460,7 +460,9 @@ struct _VipsObjectClass { */ void (*summary_class)( struct _VipsObjectClass *, VipsBuf * ); - /* Try to print a one-line summary for the object, handy for debugging. + /* Try to print a one-line summary for the object, the user can see + * this output via things like "header fred.tif", --vips-cache-trace, + * etc. */ void (*summary)( VipsObject *, VipsBuf * ); diff --git a/libvips/iofuncs/image.c b/libvips/iofuncs/image.c index ed35c890..9ccc47b9 100644 --- a/libvips/iofuncs/image.c +++ b/libvips/iofuncs/image.c @@ -379,6 +379,9 @@ vips_image_dump( VipsObject *object, VipsBuf *buf ) vips_enum_nick( VIPS_TYPE_INTERPRETATION, vips_image_get_interpretation( image ) ) ); + vips_buf_appendf( buf, ", %s", + vips_enum_nick( VIPS_TYPE_IMAGE_TYPE, image->dtype ) ); + VIPS_OBJECT_CLASS( vips_image_parent_class )->dump( object, buf ); vips_buf_appendf( buf, "\n" ); @@ -412,8 +415,6 @@ vips_image_summary( VipsObject *object, VipsBuf *buf ) vips_enum_nick( VIPS_TYPE_CODING, vips_image_get_coding( image ) ) ); } - vips_buf_appendf( buf, ", %s", - vips_enum_nick( VIPS_TYPE_IMAGE_TYPE, image->dtype ) ); VIPS_OBJECT_CLASS( vips_image_parent_class )->summary( object, buf ); } diff --git a/libvips/iofuncs/object.c b/libvips/iofuncs/object.c index e9ac5d78..dd19990a 100644 --- a/libvips/iofuncs/object.c +++ b/libvips/iofuncs/object.c @@ -1197,14 +1197,13 @@ vips_object_real_summary_class( VipsObjectClass *class, VipsBuf *buf ) static void vips_object_real_summary( VipsObject *object, VipsBuf *buf ) { - vips_buf_appendf( buf, " %s (%p)", - G_OBJECT_TYPE_NAME( object ), object ); } static void vips_object_real_dump( VipsObject *object, VipsBuf *buf ) { - vips_buf_appendf( buf, " (%p)", object ); + vips_buf_appendf( buf, " %s (%p)", + G_OBJECT_TYPE_NAME( object ), object ); } static void