vips_sink_screen() now invalidates for you

clients no longer need to call vips_image_invalidate_all()
This commit is contained in:
John Cupitt 2014-01-28 13:08:02 +00:00
parent c80e7292be
commit 16830d6937
5 changed files with 31 additions and 13 deletions

10
TODO
View File

@ -1,13 +1,3 @@
- try:
$ vips falsecolour k2.jpg x.jpg
vips warning: VipsJpeg: read gave 896 warnings
vips warning: VipsJpeg: Application transferred too many scanlines
seems to read twice?
problem in 7.38 too
- vips_colourspace() needs an option from_space param,?
- check_uncoded() left to do:

View File

@ -120,6 +120,8 @@ int vips_region_prepare_to( VipsRegion *reg,
VipsRegion *dest, VipsRect *r, int x, int y );
int vips_region_prepare_many( VipsRegion **reg, VipsRect *r );
void vips_region_invalidate( VipsRegion *reg );
void vips_region_dump_all( void );
/* Macros on VipsRegion.

View File

@ -953,9 +953,9 @@ vips_image_build( VipsObject *object )
}
static void *
vips_region_invalidate( VipsRegion *reg )
vips_image_real_invalidate_cb( VipsRegion *reg )
{
reg->invalid = TRUE;
vips_region_invalidate( reg );
return( NULL );
}
@ -972,7 +972,7 @@ vips_image_real_invalidate( VipsImage *image )
VIPS_GATE_STOP( "vips_image_real_invalidate: wait" );
(void) vips_slist_map2( image->regions,
(VipsSListMap2Fn) vips_region_invalidate, NULL, NULL );
(VipsSListMap2Fn) vips_image_real_invalidate_cb, NULL, NULL );
g_mutex_unlock( image->sslock );
}
@ -1274,6 +1274,8 @@ vips_image_invalidate_all_cb( VipsImage *image )
* is, images which depend on this image.
*
* The "invalidate" callback is triggered for all invalidated images.
*
* See also: vips_region_invalidate().
*/
void
vips_image_invalidate_all( VipsImage *image )

View File

@ -1375,6 +1375,25 @@ vips_region_prepare_many( VipsRegion **reg, VipsRect *r )
return( 0 );
}
/**
* vips_region_invalidate:
* @reg: region to invalidate
*
* Mark a region as containing invalid pixels. Calling this function means
* that the next time vips_region_prepare() is called, the region will be
* recalculated.
*
* This is faster than calling vips_image_invalidate_all(), but obviously only
* affects a single region.
*
* See also: vips_image_invalidate_all(), vips_region_prepare().
*/
void
vips_region_invalidate( VipsRegion *reg )
{
reg->invalid = TRUE;
}
#ifdef VIPS_DEBUG
static void *
vips_region_dump_all_cb( VipsRegion *region, size_t *alive )

View File

@ -424,6 +424,11 @@ render_work( VipsThreadState *state, void *a )
}
tile->painted = TRUE;
/* All downstream images must drop caches, since we've (effectively)
* modified render->out.
*/
vips_image_invalidate_all( render->out );
/* Now clients can update.
*/
if( render->notify )