better termination handling
setting and detecting ->kill is now treated more like a message ... you can now cancel calculation in nip2 without breaking calculation
This commit is contained in:
parent
1e21963f83
commit
1cfa33e4fb
@ -1,6 +1,7 @@
|
||||
10/8/11 started 7.26.3
|
||||
- don't use G_VALUE_COLLECT_INIT(), many platforms do not have a glib this
|
||||
recent
|
||||
- don't leave image->kill set when we detect termination
|
||||
|
||||
10/8/11 started 7.26.2
|
||||
- oops, im_benchmark.c had some stuff turned off
|
||||
|
@ -1348,20 +1348,33 @@ vips_image_set_progress( VipsImage *image, gboolean progress )
|
||||
gboolean
|
||||
vips_image_get_kill( VipsImage *image )
|
||||
{
|
||||
gboolean kill;
|
||||
|
||||
kill = image->kill;
|
||||
|
||||
/* Has kill been set for this image? If yes, abort evaluation.
|
||||
*/
|
||||
if( image->kill )
|
||||
if( image->kill ) {
|
||||
VIPS_DEBUG_MSG( "vips_image_get_kill: %s (%p) killed\n",
|
||||
image->filename, image );
|
||||
vips_error( "VipsImage",
|
||||
_( "killed for image \"%s\"" ), image->filename );
|
||||
|
||||
return( image->kill );
|
||||
/* We've picked up the kill message, it's now our caller's
|
||||
* responsibility to pass the message up the chain.
|
||||
*/
|
||||
vips_image_set_kill( image, FALSE );
|
||||
}
|
||||
|
||||
return( kill );
|
||||
}
|
||||
|
||||
void
|
||||
vips_image_set_kill( VipsImage *image, gboolean kill )
|
||||
{
|
||||
if( !image->kill )
|
||||
VIPS_DEBUG_MSG( "vips_image_set_kill: %s\n", image->filename );
|
||||
if( image->kill != kill )
|
||||
VIPS_DEBUG_MSG( "vips_image_set_kill: %s (%p) %d\n",
|
||||
image->filename, image, kill );
|
||||
|
||||
image->kill = kill;
|
||||
}
|
||||
@ -1880,6 +1893,10 @@ vips_image_write_line( VipsImage *image, int ypos, PEL *linebuffer )
|
||||
/* Is this the start of eval?
|
||||
*/
|
||||
if( ypos == 0 ) {
|
||||
/* Always clear kill before we start looping. See the
|
||||
* call to vips_image_get_kill() below.
|
||||
*/
|
||||
vips_image_set_kill( image, FALSE );
|
||||
vips__image_write_prepare( image );
|
||||
vips_image_preeval( image );
|
||||
}
|
||||
|
@ -203,6 +203,11 @@ sink_free( Sink *sink )
|
||||
void
|
||||
vips_sink_base_init( SinkBase *sink_base, VipsImage *image )
|
||||
{
|
||||
/* Always clear kill before we start looping. See the
|
||||
* call to vips_image_get_kill() below.
|
||||
*/
|
||||
vips_image_set_kill( image, FALSE );
|
||||
|
||||
sink_base->im = image;
|
||||
sink_base->x = 0;
|
||||
sink_base->y = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user