simplify eval handling
put the "hide-progress" test into the signal dispatch
This commit is contained in:
parent
74089aa2e4
commit
eb91dda83c
@ -775,9 +775,6 @@ vips_image_preeval_cb( VipsImage *image, VipsProgress *progress, int *last )
|
|||||||
int tile_height;
|
int tile_height;
|
||||||
int nlines;
|
int nlines;
|
||||||
|
|
||||||
if( vips_image_get_typeof( image, "hide-progress" ) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
*last = -1;
|
*last = -1;
|
||||||
|
|
||||||
vips_get_tile_size( image,
|
vips_get_tile_size( image,
|
||||||
@ -794,9 +791,6 @@ vips_image_preeval_cb( VipsImage *image, VipsProgress *progress, int *last )
|
|||||||
static void
|
static void
|
||||||
vips_image_eval_cb( VipsImage *image, VipsProgress *progress, int *last )
|
vips_image_eval_cb( VipsImage *image, VipsProgress *progress, int *last )
|
||||||
{
|
{
|
||||||
if( vips_image_get_typeof( image, "hide-progress" ) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( progress->percent != *last ) {
|
if( progress->percent != *last ) {
|
||||||
printf( _( "%s %s: %d%% complete" ),
|
printf( _( "%s %s: %d%% complete" ),
|
||||||
g_get_prgname(), image->filename,
|
g_get_prgname(), image->filename,
|
||||||
@ -815,9 +809,6 @@ vips_image_eval_cb( VipsImage *image, VipsProgress *progress, int *last )
|
|||||||
static void
|
static void
|
||||||
vips_image_posteval_cb( VipsImage *image, VipsProgress *progress )
|
vips_image_posteval_cb( VipsImage *image, VipsProgress *progress )
|
||||||
{
|
{
|
||||||
if( vips_image_get_typeof( image, "hide-progress" ) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Spaces at end help to erase the %complete message we overwrite.
|
/* Spaces at end help to erase the %complete message we overwrite.
|
||||||
*/
|
*/
|
||||||
printf( _( "%s %s: done in %.3gs \n" ),
|
printf( _( "%s %s: done in %.3gs \n" ),
|
||||||
@ -1549,9 +1540,10 @@ vips_image_preeval( VipsImage *image )
|
|||||||
*/
|
*/
|
||||||
(void) vips_progress_add( image->progress_signal );
|
(void) vips_progress_add( image->progress_signal );
|
||||||
|
|
||||||
g_signal_emit( image->progress_signal,
|
if( !vips_image_get_typeof( image, "hide-progress" ) )
|
||||||
vips_image_signals[SIG_PREEVAL], 0,
|
g_signal_emit( image->progress_signal,
|
||||||
image->progress_signal->time );
|
vips_image_signals[SIG_PREEVAL], 0,
|
||||||
|
image->time );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1577,8 +1569,10 @@ vips_image_eval( VipsImage *image, guint64 processed )
|
|||||||
vips_progress_update( image->progress_signal->time,
|
vips_progress_update( image->progress_signal->time,
|
||||||
processed );
|
processed );
|
||||||
|
|
||||||
g_signal_emit( image->progress_signal,
|
if( !vips_image_get_typeof( image, "hide-progress" ) )
|
||||||
vips_image_signals[SIG_EVAL], 0, image->time );
|
g_signal_emit( image->progress_signal,
|
||||||
|
vips_image_signals[SIG_EVAL], 0,
|
||||||
|
image->time );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1587,15 +1581,15 @@ vips_image_posteval( VipsImage *image )
|
|||||||
{
|
{
|
||||||
if( image->progress_signal &&
|
if( image->progress_signal &&
|
||||||
image->progress_signal->time ) {
|
image->progress_signal->time ) {
|
||||||
VipsProgress *progress = image->progress_signal->time;
|
|
||||||
|
|
||||||
VIPS_DEBUG_MSG( "vips_image_posteval: %p\n", image );
|
VIPS_DEBUG_MSG( "vips_image_posteval: %p\n", image );
|
||||||
|
|
||||||
g_assert( vips_object_sanity(
|
g_assert( vips_object_sanity(
|
||||||
VIPS_OBJECT( image->progress_signal ) ) );
|
VIPS_OBJECT( image->progress_signal ) ) );
|
||||||
|
|
||||||
g_signal_emit( image->progress_signal,
|
if( !vips_image_get_typeof( image, "hide-progress" ) )
|
||||||
vips_image_signals[SIG_POSTEVAL], 0, progress );
|
g_signal_emit( image->progress_signal,
|
||||||
|
vips_image_signals[SIG_POSTEVAL], 0,
|
||||||
|
image->time );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user