From 3a9f0d50fa536983c5fe70f44a682a0a37068c70 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 19 Apr 2010 11:00:28 +0000 Subject: [PATCH] remove im_iterate() uses --- ChangeLog | 1 + TODO | 3 --- libvips/arithmetic/im_avg.c | 10 +++++----- libvips/arithmetic/im_maxpos.c | 2 +- libvips/arithmetic/im_maxpos_avg.c | 2 +- libvips/arithmetic/im_maxpos_vec.c | 4 ++-- libvips/arithmetic/im_minpos.c | 2 +- libvips/histograms_lut/im_histgr.c | 2 +- libvips/histograms_lut/im_histindexed.c | 2 +- libvips/histograms_lut/im_histnD.c | 2 +- libvips/histograms_lut/im_project.c | 2 +- 11 files changed, 15 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index c29ae0b8..2098fe3e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,7 @@ - im_vips2tiff() uses vips_sink() instead of threadgroup - strip out threadgroup - add --enable-debug=xxx flag +- im_iterate() -> vips_sink() 16/1/10 started 7.21.2 - "invalidate" is careful to keep images alive, so invalidate callbacks can do diff --git a/TODO b/TODO index 11236c01..3830622e 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,4 @@ -- im_iterate() is deprecated: change to vips_sink() throughout - - - expose more of the tone funcs in nip2 diff --git a/libvips/arithmetic/im_avg.c b/libvips/arithmetic/im_avg.c index 34d72b57..c13005de 100644 --- a/libvips/arithmetic/im_avg.c +++ b/libvips/arithmetic/im_avg.c @@ -86,7 +86,7 @@ typedef struct _Wrapscan { } Wrapscan; static void * -wrapscan_start( IMAGE *in, void *a, void *b ) +wrapscan_start( VipsImage *in, void *a, void *b ) { Wrapscan *wrapscan = (Wrapscan *) a; @@ -122,12 +122,12 @@ wrapscan_scan( REGION *reg, void *seq, void *a, void *b ) return( 0 ); } -/* Like im_iterate(), but the scan function works a line at a time, like +/* Like vips_sink(), but the scan function works a line at a time, like * im_wrap*(). Shared with im_min(), im_deviate() etc. */ int -im__wrapscan( IMAGE *in, - im_start_fn start, im__wrapscan_fn scan, im_stop_fn stop, +im__wrapscan( VipsImage *in, + VipsStart start, im__wrapscan_fn scan, VipsStop stop, void *a, void *b ) { Wrapscan wrapscan; @@ -139,7 +139,7 @@ im__wrapscan( IMAGE *in, wrapscan.a = a; wrapscan.b = b; - return( im_iterate( in, + return( vips_sink( in, wrapscan_start, wrapscan_scan, wrapscan_stop, &wrapscan, NULL ) ); } diff --git a/libvips/arithmetic/im_maxpos.c b/libvips/arithmetic/im_maxpos.c index 442e8089..a7d98a80 100644 --- a/libvips/arithmetic/im_maxpos.c +++ b/libvips/arithmetic/im_maxpos.c @@ -222,7 +222,7 @@ im_maxpos( IMAGE *in, int *xpos, int *ypos, double *out ) if( vips_bandfmt_iscomplex( in->BandFmt ) ) global_maxpos->max *= global_maxpos->max; - if( im_iterate( in, maxpos_start, maxpos_scan, maxpos_stop, + if( vips_sink( in, maxpos_start, maxpos_scan, maxpos_stop, in, global_maxpos ) ) return( -1 ); diff --git a/libvips/arithmetic/im_maxpos_avg.c b/libvips/arithmetic/im_maxpos_avg.c index a8344323..28a44abe 100644 --- a/libvips/arithmetic/im_maxpos_avg.c +++ b/libvips/arithmetic/im_maxpos_avg.c @@ -238,7 +238,7 @@ im_maxpos_avg( IMAGE *in, double *xpos, double *ypos, double *out ) if( vips_bandfmt_iscomplex( in->BandFmt ) ) global_maxposavg->max *= global_maxposavg->max; - if( im_iterate( in, maxposavg_start, maxposavg_scan, maxposavg_stop, + if( vips_sink( in, maxposavg_start, maxposavg_scan, maxposavg_stop, in, global_maxposavg ) ) return( -1 ); diff --git a/libvips/arithmetic/im_maxpos_vec.c b/libvips/arithmetic/im_maxpos_vec.c index f8ac989a..cecf9e7e 100644 --- a/libvips/arithmetic/im_maxpos_vec.c +++ b/libvips/arithmetic/im_maxpos_vec.c @@ -143,7 +143,7 @@ int im_maxpos_vec( IMAGE *im, int *xpos, int *ypos, double *maxima, int n ){ maxpos_list_init( &master_list, n ); - result= im_iterate( im, maxpos_vec_start, maxpos_vec_scan, maxpos_vec_stop, &n, &master_list ); + result= vips_sink( im, maxpos_vec_start, maxpos_vec_scan, maxpos_vec_stop, &n, &master_list ); im_free( pointers ); @@ -208,7 +208,7 @@ int im_minpos_vec( IMAGE *im, int *xpos, int *ypos, double *minima, int n ){ minpos_list_init( &master_list, n ); - result= im_iterate( im, minpos_vec_start, minpos_vec_scan, minpos_vec_stop, &n, &master_list ); + result= vips_sink( im, minpos_vec_start, minpos_vec_scan, minpos_vec_stop, &n, &master_list ); im_free( pointers ); diff --git a/libvips/arithmetic/im_minpos.c b/libvips/arithmetic/im_minpos.c index e0e48631..30380041 100644 --- a/libvips/arithmetic/im_minpos.c +++ b/libvips/arithmetic/im_minpos.c @@ -222,7 +222,7 @@ im_minpos( IMAGE *in, int *xpos, int *ypos, double *out ) if( vips_bandfmt_iscomplex( in->BandFmt ) ) global_minpos->min *= global_minpos->min; - if( im_iterate( in, minpos_start, minpos_scan, minpos_stop, + if( vips_sink( in, minpos_start, minpos_scan, minpos_stop, in, global_minpos ) ) return( -1 ); diff --git a/libvips/histograms_lut/im_histgr.c b/libvips/histograms_lut/im_histgr.c index c2763218..20922742 100644 --- a/libvips/histograms_lut/im_histgr.c +++ b/libvips/histograms_lut/im_histgr.c @@ -347,7 +347,7 @@ im_histgr( IMAGE *in, IMAGE *out, int bandno ) /* Accumulate data. */ - if( im_iterate( in, + if( vips_sink( in, build_subhist, scanfn, merge_subhist, mhist, NULL ) ) return( -1 ); diff --git a/libvips/histograms_lut/im_histindexed.c b/libvips/histograms_lut/im_histindexed.c index b1485358..d08e71eb 100644 --- a/libvips/histograms_lut/im_histindexed.c +++ b/libvips/histograms_lut/im_histindexed.c @@ -360,7 +360,7 @@ im_hist_indexed( IMAGE *index, IMAGE *value, IMAGE *out ) /* Accumulate data. */ - if( im_iterate( index, + if( vips_sink( index, hist_start, scanfn, hist_stop, mhist, NULL ) || hist_write( out, mhist ) ) { hist_free( mhist ); diff --git a/libvips/histograms_lut/im_histnD.c b/libvips/histograms_lut/im_histnD.c index d2f90b90..8fbcb5e9 100644 --- a/libvips/histograms_lut/im_histnD.c +++ b/libvips/histograms_lut/im_histnD.c @@ -239,7 +239,7 @@ im_histnD( IMAGE *in, IMAGE *out, int bins ) /* Accumulate data. */ - if( im_iterate( in, + if( vips_sink( in, build_subhist, find_hist, merge_subhist, mhist, NULL ) ) return( -1 ); diff --git a/libvips/histograms_lut/im_project.c b/libvips/histograms_lut/im_project.c index 7a916678..b3c69cc8 100644 --- a/libvips/histograms_lut/im_project.c +++ b/libvips/histograms_lut/im_project.c @@ -288,7 +288,7 @@ im_project( IMAGE *in, IMAGE *hout, IMAGE *vout ) /* Accumulate data. */ - if( im_iterate( in, + if( vips_sink( in, project_new_sub, project_scan, project_merge, mproject, NULL ) ) return( -1 );