From cc6535acff94527ddab5759c7fc88be35f5eb2dc Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 11 Mar 2011 14:08:10 +0000 Subject: [PATCH] rename ->progress ->progress, the image we signal progress on, has become progress_signal. There's a progress class as well now, it was just too confusing. --- TODO | 26 +------------------------- libvips/include/vips/image.h | 2 +- libvips/iofuncs/im_demand_hint.c | 10 ++++++---- libvips/iofuncs/image.c | 20 ++++++++++---------- libvips/iofuncs/object.c | 14 +++++++------- 5 files changed, 25 insertions(+), 47 deletions(-) diff --git a/TODO b/TODO index a9f8274e..30aaf8ca 100644 --- a/TODO +++ b/TODO @@ -1,21 +1,6 @@ - -- tools/others/sines.c and friends can go - - -- why not rename VipsBandFormat as VipsFormat? cf. VipsCoding, - VipsInterpretation etc. - - argh because of the format package and the VipsFormat there - -- image->progress needs renaming, perhaps image->progress_signal? - -- im_sanity() should become a method on VipsObject, see debug.c - - rename Rect to VipsRect -- remove im__handle_eval etc. from headers - - png read/write needs redoing: http://www.libpng.org/pub/png/src/libpng-1.4.x-to-1.5.x-summary.txt @@ -51,16 +36,7 @@ how dumb, common this up somehow -- pre/post/close should be on VipsObject, not VipsImage - - decls for im_local etc. are now in image.h, move them to object.h and the - code to object.c - - how about vips_local_array()? - - also see im_bits_of_fmt() - - decls for type_map etc. are now in object.h, move the code to object.c +- decls for type_map etc. are now in object.h, move the code to object.c diff --git a/libvips/include/vips/image.h b/libvips/include/vips/image.h index 54dceff8..b9683426 100644 --- a/libvips/include/vips/image.h +++ b/libvips/include/vips/image.h @@ -245,7 +245,7 @@ typedef struct _VipsImage { /* The VipsImage (if any) we should signal eval progress on. */ - struct _VipsImage *progress; + struct _VipsImage *progress_signal; /* Record the file length here. We use this to stop ourselves mapping * things beyond the end of the file in the case that the file has diff --git a/libvips/iofuncs/im_demand_hint.c b/libvips/iofuncs/im_demand_hint.c index b52f8b53..7c262809 100644 --- a/libvips/iofuncs/im_demand_hint.c +++ b/libvips/iofuncs/im_demand_hint.c @@ -82,8 +82,9 @@ im__link_make( IMAGE *im_up, IMAGE *im_down ) /* Propogate the progress indicator. */ - if( im_up->progress && !im_down->progress ) - im_down->progress = im_up->progress; + if( im_up->progress_signal && + !im_down->progress_signal ) + im_down->progress_signal = im_up->progress_signal; } static void * @@ -99,8 +100,9 @@ im__link_break( IMAGE *im_up, IMAGE *im_down ) /* Unlink the progress chain. */ - if( im_down->progress && im_down->progress == im_up->progress ) - im_down->progress = NULL; + if( im_down->progress_signal && + im_down->progress_signal == im_up->progress_signal ) + im_down->progress_signal = NULL; return( NULL ); } diff --git a/libvips/iofuncs/image.c b/libvips/iofuncs/image.c index f09113a0..9f5eb5d4 100644 --- a/libvips/iofuncs/image.c +++ b/libvips/iofuncs/image.c @@ -1373,18 +1373,18 @@ vips_progress_add( VipsImage *image ) void vips_image_preeval( VipsImage *image ) { - if( image->progress ) { + if( image->progress_signal ) { #ifdef VIPS_DEBUG printf( "vips_image_preeval: " ); vips_object_print( VIPS_OBJECT( image ) ); #endif /*VIPS_DEBUG*/ g_assert( vips_object_sanity( - VIPS_OBJECT( image->progress ) ) ); + VIPS_OBJECT( image->progress_signal ) ) ); - (void) vips_progress_add( image->progress ); + (void) vips_progress_add( image->progress_signal ); - g_signal_emit( image->progress, + g_signal_emit( image->progress_signal, vips_image_signals[SIG_PREEVAL], 0, image->time ); } } @@ -1394,7 +1394,7 @@ vips_image_preeval( VipsImage *image ) void vips_image_eval( VipsImage *image, int w, int h ) { - if( image->progress ) { + if( image->progress_signal ) { VipsProgress *progress = image->time; float prop; @@ -1404,7 +1404,7 @@ vips_image_eval( VipsImage *image, int w, int h ) #endif /*VIPS_DEBUG*/ g_assert( vips_object_sanity( - VIPS_OBJECT( image->progress ) ) ); + VIPS_OBJECT( image->progress_signal ) ) ); progress->run = g_timer_elapsed( progress->start, NULL ); progress->npels += w * h; @@ -1414,7 +1414,7 @@ vips_image_eval( VipsImage *image, int w, int h ) progress->eta = (1.0 / prop) * progress->run - progress->run; - g_signal_emit( image->progress, + g_signal_emit( image->progress_signal, vips_image_signals[SIG_EVAL], 0, progress ); } } @@ -1422,16 +1422,16 @@ vips_image_eval( VipsImage *image, int w, int h ) void vips_image_posteval( VipsImage *image ) { - if( image->progress ) { + if( image->progress_signal ) { #ifdef VIPS_DEBUG printf( "vips_image_posteval: " ); vips_object_print( VIPS_OBJECT( image ) ); #endif /*VIPS_DEBUG*/ g_assert( vips_object_sanity( - VIPS_OBJECT( image->progress ) ) ); + VIPS_OBJECT( image->progress_signal ) ) ); - g_signal_emit( image->progress, + g_signal_emit( image->progress_signal, vips_image_signals[SIG_POSTEVAL], 0, image->time ); } } diff --git a/libvips/iofuncs/object.c b/libvips/iofuncs/object.c index 52e452d3..6c79860d 100644 --- a/libvips/iofuncs/object.c +++ b/libvips/iofuncs/object.c @@ -69,7 +69,7 @@ enum { /* Table of all objects, handy for debugging. */ -static GHashTable *vips_object_all = NULL; +static GHashTable *vips__object_all = NULL; static guint vips_object_signals[SIG_LAST] = { 0 }; @@ -454,7 +454,7 @@ vips_object_finalize( GObject *gobject ) vips_object_close( object ); - g_hash_table_remove( vips_object_all, object ); + g_hash_table_remove( vips__object_all, object ); G_OBJECT_CLASS( vips_object_parent_class )->finalize( gobject ); @@ -836,8 +836,8 @@ vips_object_class_init( VipsObjectClass *class ) GParamSpec *pspec; - if( !vips_object_all ) - vips_object_all = g_hash_table_new( + if( !vips__object_all ) + vips__object_all = g_hash_table_new( g_direct_hash, g_direct_equal ); gobject_class->dispose = vips_object_dispose; @@ -920,7 +920,7 @@ vips_object_init( VipsObject *object ) vips_object_print( object ); #endif /*DEBUG*/ - g_hash_table_insert( vips_object_all, object, object ); + g_hash_table_insert( vips__object_all, object, object ); } /* Add a vipsargument ... automate some stuff with this. @@ -1227,8 +1227,8 @@ vips_object_map( VSListMap2Fn fn, void *a, void *b ) args.a = a; args.b = b; args.result = NULL; - if( vips_object_all ) - g_hash_table_foreach( vips_object_all, + if( vips__object_all ) + g_hash_table_foreach( vips__object_all, (GHFunc) vips_object_map_sub, &args ); return( args.result );