fix im_cache

im_cache updated
This commit is contained in:
John Cupitt 2011-03-25 12:52:48 +00:00
parent 553ccc9e45
commit 56840af97d
6 changed files with 28 additions and 24 deletions

View File

@ -417,15 +417,6 @@ im_render_priority( IMAGE *in, IMAGE *out, IMAGE *mask,
return( vips_sink_screen( in, out, mask,
width, height, max, priority, notify, client ) );
}
int
im_cache( IMAGE *in, IMAGE *out, int width, int height, int max )
{
return( im_render_priority( in, out, NULL,
width, height, max,
0,
NULL, NULL ) );
}
/**
* im_circle:

View File

@ -135,6 +135,14 @@ int im_iterate( VipsImage *im,
void *a, void *b
);
/* Async rendering.
*/
int im_render_priority( VipsImage *in, VipsImage *out, VipsImage *mask,
int width, int height, int max,
int priority,
void (*notify)( VipsImage *, VipsRect *, void * ), void *client );
int im_cache( VipsImage *in, VipsImage *out, int width, int height, int max );
/* Deprecated operations.
*/
int im_cmulnorm( IMAGE *in1, IMAGE *in2, IMAGE *out );

View File

@ -57,14 +57,6 @@ int vips_demand_hint_array( VipsImage *image,
int vips_demand_hint( VipsImage *image, VipsDemandStyle hint, ... )
__attribute__((sentinel));
/* Async rendering.
*/
int im_render_priority( VipsImage *in, VipsImage *out, VipsImage *mask,
int width, int height, int max,
int priority,
void (*notify)( VipsImage *, VipsRect *, void * ), void *client );
int im_cache( VipsImage *in, VipsImage *out, int width, int height, int max );
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@ -145,10 +145,12 @@ int vips_sink_screen( VipsImage *in, VipsImage *out, VipsImage *mask,
int tile_width, int tile_height, int max_tiles,
int priority,
VipsSinkNotify notify, void *a );
int vips_image_cache( VipsImage *in, VipsImage *out,
int width, int height, int max );
int vips_sink_memory( VipsImage *im );
void im__print_renders( void );
void vips__print_renders( void );
void im_concurrency_set( int concurrency );
int im_concurrency_get( void );

View File

@ -300,6 +300,9 @@ VipsDemandStyle im_char2dhint( const char *str );
#define im_mapfilerw vips_mapfilerw
#define im_remapfilerw vips_remapfilerw
#define im__print_renders vips__print_renders
#define im_cache vips_image_cache
/* Buffer processing.
*/
typedef void (*im_wrapone_fn)( void *in, void *out, int width,

View File

@ -1048,7 +1048,8 @@ mask_fill( VipsRegion *out, void *seq, void *a, void *b )
* Calls to vips_region_prepare() on @out return immediately and hold
* whatever is
* currently in cache for that #VipsRect (check @mask to see which parts of the
* #VipsRect are valid). Any pixels in the #VipsRect which are not in cache are added
* #VipsRect are valid). Any pixels in the #VipsRect which are not in
* cache are added
* to a queue, and the @notify callback will trigger when those pixels are
* ready.
*
@ -1057,13 +1058,12 @@ mask_fill( VipsRegion *out, void *seq, void *a, void *b )
* you need to somehow send a message to the main thread that the pixels are
* ready. In a glib-based application, this is easily done with g_idle_add().
*
* If @notify is %NULL then im_render_priority() runs synchronously.
* If @notify is %NULL then vips_sink_screen() runs synchronously.
* vips_region_prepare() on @out will always block until the pixels have been
* calculated.
*
* See also: im_cache(), im_tile_cache(), vips_region_prepare(),
* vips_sink_disc(),
* vips_sink().
* See also: vips_image_cache(), im_tile_cache(), vips_region_prepare(),
* vips_sink_disc(), vips_sink().
*
* Returns: 0 on sucess, -1 on error.
*/
@ -1122,10 +1122,18 @@ vips_sink_screen( VipsImage *in, VipsImage *out, VipsImage *mask,
}
void
im__print_renders( void )
vips__print_renders( void )
{
#ifdef VIPS_DEBUG_AMBER
printf( "%d active renders\n", render_num_renders );
#endif /*VIPS_DEBUG_AMBER*/
printf( "%d dirty renders\n", g_slist_length( render_dirty_all ) );
}
int
vips_image_cache( VipsImage *in, VipsImage *out,
int width, int height, int max )
{
return( vips_sink_screen( in, out, NULL,
width, height, max, 0, NULL, NULL ) );
}