remove outchecks, again

This commit is contained in:
John Cupitt 2011-12-21 19:00:32 +00:00
parent a62f5f8832
commit 49d3542cc7
8 changed files with 34 additions and 48 deletions

View File

@ -64,6 +64,7 @@
- allow new-style load/save options in filenames to
vips_image_new_from_file() etc.
- VipsFormat is deprecated
- remove outchecks from documented API
12/10/11 started 7.26.6
- NOCACHE was not being set correctly on OS X causing performance

11
TODO
View File

@ -1,13 +1,4 @@
- what should we call before writing to the ->data pointer?
vips_image_wio_output() just checks the desc, it does no allocation
vips__image_write_prepare() is an internal function
we need a new API thing to replace both these just for the pre-data case,
and we need to make a note of it in VIPS_IMAGE_ADDR()
- foreign docs

View File

@ -334,7 +334,7 @@ vips__openslide_read_associated( const char *filename, VipsImage *out,
vips_object_local( out, raw );
if( !(rslide = readslide_new( filename, raw, 0, associated )) ||
vips_image_wio_output( raw ) )
vips_image_write_prepare( raw ) )
return( -1 );
openslide_read_associated_image( rslide->osr, rslide->associated,
(uint32_t *) VIPS_IMAGE_ADDR( raw, 0, 0 ) );

View File

@ -488,13 +488,12 @@ gboolean vips_image_isMSBfirst( VipsImage *image );
gboolean vips_image_isfile( VipsImage *image );
gboolean vips_image_ispartial( VipsImage *image );
int vips_image_write_line( VipsImage *image, int ypos, PEL *linebuffer );
int vips_image_wio_input( VipsImage *image );
int vips_image_wio_output( VipsImage *image );
int vips_image_inplace( VipsImage *image );
int vips_image_pio_input( VipsImage *image );
int vips_image_pio_output( VipsImage *image );
int vips_image_inplace( VipsImage *image );
int vips_image_write_prepare( VipsImage *image );
int vips_image_write_line( VipsImage *image, int ypos, PEL *linebuffer );
gboolean vips_band_format_isint( VipsBandFormat format );
gboolean vips_band_format_isuint( VipsBandFormat format );

View File

@ -157,9 +157,8 @@ typedef int (*VipsRegionFillFn)( struct _VipsRegion *, void * );
int vips_region_fill( struct _VipsRegion *reg,
VipsRect *r, VipsRegionFillFn fn, void *a );
/* The new name for im_setupout(), still used by some old code.
*/
int vips__image_write_prepare( struct _VipsImage *image );
int vips__image_wio_output( struct _VipsImage *image );
int vips__image_pio_output( struct _VipsImage *image );
#ifdef __cplusplus
}

View File

@ -170,7 +170,7 @@ extern "C" {
type, xres, yres )
#define im__open_image_file vips__open_image_read
#define im_setupout( I ) vips__image_write_prepare( I )
#define im_setupout( I ) (0)
#define im_writeline( Y, IM, P ) vips_image_write_line( IM, Y, P )
#define im_prepare vips_region_prepare
@ -326,13 +326,13 @@ G_STMT_START { \
#define IM_ARRAY( IM, N, T ) ((T *) im_malloc( (IM), (N) * sizeof( T )))
#define im_incheck vips_image_wio_input
#define im_outcheck vips_image_wio_output
#define im_outcheck( I ) (0)
#define im_rwcheck vips_image_inplace
#define im_pincheck vips_image_pio_input
#define im_poutcheck vips_image_pio_output
#define im_poutcheck( I ) (0)
#define im_iocheck( I, O ) (im_incheck( I ) || im_outcheck( O ))
#define im_piocheck( I, O ) (im_pincheck( I ) || im_poutcheck( O ))
#define im_iocheck( I, O ) im_incheck( I )
#define im_piocheck( I, O ) im_pincheck( I )
#define im_check_uncoded vips_check_uncoded
#define im_check_coding_known vips_check_coding_known

View File

@ -659,9 +659,7 @@ vips_image_generate( VipsImage *image,
image->client1 = a;
image->client2 = b;
/* Get output ready.
*/
if( vips__image_write_prepare( image ) )
if( vips_image_write_prepare( image ) )
return( -1 );
if( image->dtype == VIPS_IMAGE_OPENOUT )

View File

@ -1539,7 +1539,7 @@ vips_image_new_array( int xsize, int ysize )
return( NULL );
}
if( vips__image_write_prepare( image ) ) {
if( vips_image_write_prepare( image ) ) {
g_object_unref( image );
return( NULL );
}
@ -1737,12 +1737,21 @@ vips_image_ispartial( VipsImage *image )
return( 0 );
}
/* Get the image ready for writing. This can get called many
* times. Used by vips_image_generate() and vips_image_write_line(). vips7
* compat can call this as im_setupout().
/**
* vips_image_write_prepare:
* @image: image to prepare
*
* Call this after setting header fields (width, height, and so on) to
* allocate resources ready for writing.
*
* Normally this function is called for you by vips_image_generate() or
* vips_image_write_line(). You will need to call it yourself if you plan to
* write directly to the ->data member of a "t" image.
*
* Returns: 0 on success, or -1 on error.
*/
int
vips__image_write_prepare( VipsImage *image )
vips_image_write_prepare( VipsImage *image )
{
g_assert( vips_object_sanity( VIPS_OBJECT( image ) ) );
@ -1759,7 +1768,7 @@ vips__image_write_prepare( VipsImage *image )
image->Bbits = vips_format_sizeof( image->BandFmt ) << 3;
if( image->dtype == VIPS_IMAGE_PARTIAL ) {
VIPS_DEBUG_MSG( "vips__image_write_prepare: "
VIPS_DEBUG_MSG( "vips_image_write_prepare: "
"old-style output for %s\n", image->filename );
image->dtype = VIPS_IMAGE_SETBUF;
@ -1816,14 +1825,14 @@ vips_image_write_line( VipsImage *image, int ypos, PEL *linebuffer )
/* Is this the start of eval?
*/
if( ypos == 0 ) {
if( vips_image_wio_output( image ) )
if( vips__image_wio_output( image ) )
return( -1 );
/* 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_write_prepare( image );
vips_image_preeval( image );
}
@ -2020,19 +2029,8 @@ vips_image_wio_input( VipsImage *image )
return( 0 );
}
/**
* vips_image_wio_output:
* @image: image to check
*
* Check that an image is writeable by vips_image_write_line(). If it isn't,
* try to transform it so that vips_image_write_line() can work.
*
* See also: vips_image_wio_input().
*
* Returns: 0 on succeess, or -1 on error.
*/
int
vips_image_wio_output( VipsImage *image )
vips__image_wio_output( VipsImage *image )
{
#ifdef DEBUG_IO
printf( "vips_image_wio_output: WIO output for %s\n",
@ -2062,7 +2060,7 @@ vips_image_wio_output( VipsImage *image )
*
* We used to check that ->data was null and warn about
* writing twice, but we no longer insist that this is called
* before vips__image_write_prepare(), so we can't do that any
* before vips_image_write_prepare(), so we can't do that any
* more.
*/
break;