propogate progress feedback down pipelines
This commit is contained in:
parent
c8825917df
commit
67e7cdc4d6
@ -4,6 +4,8 @@
|
|||||||
- break im_wbuffer() out to a separate API
|
- break im_wbuffer() out to a separate API
|
||||||
- use im_wbuffer() to make im_vips2jpeg() compress in the background
|
- use im_wbuffer() to make im_vips2jpeg() compress in the background
|
||||||
- also im_vips2png()
|
- also im_vips2png()
|
||||||
|
- new system for propogating progress settings down pipelines unbreaks save
|
||||||
|
feedback in nip2
|
||||||
|
|
||||||
28/9/07 started 7.13.1
|
28/9/07 started 7.13.1
|
||||||
- vips2dj can print RGB images
|
- vips2dj can print RGB images
|
||||||
|
5
TODO
5
TODO
@ -1,5 +1,6 @@
|
|||||||
- wrap API around the double-buffered write stuff and get
|
- im__convert_saveable() is not propogating 'progress' for wtc2.jpg
|
||||||
jpeg/tiff/png/ppm/etc. all writing double-buffered as well
|
|
||||||
|
- done jpeg, png ... make others dbl-buf writes too
|
||||||
|
|
||||||
- missing libstdc++ in link? what if we configure with no openexr?
|
- missing libstdc++ in link? what if we configure with no openexr?
|
||||||
|
|
||||||
|
@ -326,6 +326,10 @@ typedef struct im__IMAGE {
|
|||||||
* efficiently.
|
* efficiently.
|
||||||
*/
|
*/
|
||||||
GSList *history_list;
|
GSList *history_list;
|
||||||
|
|
||||||
|
/* The IMAGE (if any) we should signal eval progress on.
|
||||||
|
*/
|
||||||
|
struct im__IMAGE *progress;
|
||||||
} IMAGE;
|
} IMAGE;
|
||||||
|
|
||||||
/* Only define if IM_ENABLE_DEPRECATED is set.
|
/* Only define if IM_ENABLE_DEPRECATED is set.
|
||||||
|
@ -195,8 +195,7 @@ write_vips( Write *write, int compress, int interlace )
|
|||||||
{
|
{
|
||||||
IMAGE *in = write->in;
|
IMAGE *in = write->in;
|
||||||
|
|
||||||
Rect area;
|
int i, nb_passes;
|
||||||
int j, y, i, nb_passes;
|
|
||||||
|
|
||||||
assert( in->BandFmt == IM_BANDFMT_UCHAR );
|
assert( in->BandFmt == IM_BANDFMT_UCHAR );
|
||||||
assert( in->Coding == IM_CODING_NONE );
|
assert( in->Coding == IM_CODING_NONE );
|
||||||
|
@ -475,6 +475,11 @@ im__link_make( IMAGE *parent, IMAGE *child )
|
|||||||
|
|
||||||
parent->children = g_slist_prepend( parent->children, child );
|
parent->children = g_slist_prepend( parent->children, child );
|
||||||
child->parents = g_slist_prepend( child->parents, parent );
|
child->parents = g_slist_prepend( child->parents, parent );
|
||||||
|
|
||||||
|
/* Propogate the progress indicator.
|
||||||
|
*/
|
||||||
|
if( !child->progress && parent->progress )
|
||||||
|
child->progress = parent->progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Break link.
|
/* Break link.
|
||||||
|
@ -88,11 +88,18 @@ im_add_close_callback( IMAGE *im, int (*fn)(), void *a, void *b )
|
|||||||
return( add_callback( im, &im->closefns, fn, a, b ) );
|
return( add_callback( im, &im->closefns, fn, a, b ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add an eval callback to an IMAGE.
|
/* Add an eval callback to an IMAGE. You must call this after opening the
|
||||||
|
* image, but before using it as an argument to an operation.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
im_add_eval_callback( IMAGE *im, int (*fn)(), void *a, void *b )
|
im_add_eval_callback( IMAGE *im, int (*fn)(), void *a, void *b )
|
||||||
{
|
{
|
||||||
|
/* Mark this image as needing progress feedback. im__link_make()
|
||||||
|
* propogates this value to our children as we build a pipeline.
|
||||||
|
* im__handle_eval() looks up the IMAGE it should signal on.
|
||||||
|
*/
|
||||||
|
im->progress = im;
|
||||||
|
|
||||||
return( add_callback( im, &im->evalfns, fn, a, b ) );
|
return( add_callback( im, &im->evalfns, fn, a, b ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,6 +157,8 @@ im_init( const char *filename )
|
|||||||
|
|
||||||
im->history_list = NULL;
|
im->history_list = NULL;
|
||||||
|
|
||||||
|
im->progress = NULL;
|
||||||
|
|
||||||
if( !(im->filename = im_strdup( NULL, filename )) ) {
|
if( !(im->filename = im_strdup( NULL, filename )) ) {
|
||||||
im_close( im );
|
im_close( im );
|
||||||
return( NULL );
|
return( NULL );
|
||||||
|
@ -99,18 +99,26 @@ update_time( im_time_t *time, int w, int h )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Handle eval callbacks. w and h are the size of the tile we made this time.
|
/* Handle eval callbacks. w and h are the size of the tile we made this time.
|
||||||
|
* We signal progress on the ->progress IMAGE, see im_add_eval_callback(). We
|
||||||
|
* assume there's no geometry change between adding the feedback request and
|
||||||
|
* evaling the image.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
im__handle_eval( IMAGE *im, int w, int h )
|
im__handle_eval( IMAGE *im, int w, int h )
|
||||||
{
|
{
|
||||||
if( im->evalfns ) {
|
if( im->progress ) {
|
||||||
if( !im->time )
|
if( !im->progress->time ) {
|
||||||
if( time_add( im ) )
|
/* So we just check sanity first time around.
|
||||||
|
*/
|
||||||
|
im_image_sanity( im->progress );
|
||||||
|
|
||||||
|
if( time_add( im->progress ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
if( update_time( im->time, w, h ) )
|
}
|
||||||
|
if( update_time( im->progress->time, w, h ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
if( im__trigger_callbacks( im->evalfns ) )
|
if( im__trigger_callbacks( im->progress->evalfns ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user