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 - allow new-style load/save options in filenames to
vips_image_new_from_file() etc. vips_image_new_from_file() etc.
- VipsFormat is deprecated - VipsFormat is deprecated
- remove outchecks from documented API
12/10/11 started 7.26.6 12/10/11 started 7.26.6
- NOCACHE was not being set correctly on OS X causing performance - 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? - foreign docs
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()

View File

@ -334,7 +334,7 @@ vips__openslide_read_associated( const char *filename, VipsImage *out,
vips_object_local( out, raw ); vips_object_local( out, raw );
if( !(rslide = readslide_new( filename, raw, 0, associated )) || if( !(rslide = readslide_new( filename, raw, 0, associated )) ||
vips_image_wio_output( raw ) ) vips_image_write_prepare( raw ) )
return( -1 ); return( -1 );
openslide_read_associated_image( rslide->osr, rslide->associated, openslide_read_associated_image( rslide->osr, rslide->associated,
(uint32_t *) VIPS_IMAGE_ADDR( raw, 0, 0 ) ); (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_isfile( VipsImage *image );
gboolean vips_image_ispartial( 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_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_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_isint( VipsBandFormat format );
gboolean vips_band_format_isuint( 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, int vips_region_fill( struct _VipsRegion *reg,
VipsRect *r, VipsRegionFillFn fn, void *a ); VipsRect *r, VipsRegionFillFn fn, void *a );
/* The new name for im_setupout(), still used by some old code. int vips__image_wio_output( struct _VipsImage *image );
*/ int vips__image_pio_output( struct _VipsImage *image );
int vips__image_write_prepare( struct _VipsImage *image );
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -170,7 +170,7 @@ extern "C" {
type, xres, yres ) type, xres, yres )
#define im__open_image_file vips__open_image_read #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_writeline( Y, IM, P ) vips_image_write_line( IM, Y, P )
#define im_prepare vips_region_prepare #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_ARRAY( IM, N, T ) ((T *) im_malloc( (IM), (N) * sizeof( T )))
#define im_incheck vips_image_wio_input #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_rwcheck vips_image_inplace
#define im_pincheck vips_image_pio_input #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_iocheck( I, O ) im_incheck( I )
#define im_piocheck( I, O ) (im_pincheck( I ) || im_poutcheck( O )) #define im_piocheck( I, O ) im_pincheck( I )
#define im_check_uncoded vips_check_uncoded #define im_check_uncoded vips_check_uncoded
#define im_check_coding_known vips_check_coding_known #define im_check_coding_known vips_check_coding_known

View File

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

View File

@ -1539,7 +1539,7 @@ vips_image_new_array( int xsize, int ysize )
return( NULL ); return( NULL );
} }
if( vips__image_write_prepare( image ) ) { if( vips_image_write_prepare( image ) ) {
g_object_unref( image ); g_object_unref( image );
return( NULL ); return( NULL );
} }
@ -1737,12 +1737,21 @@ vips_image_ispartial( VipsImage *image )
return( 0 ); 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 * vips_image_write_prepare:
* compat can call this as im_setupout(). * @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 int
vips__image_write_prepare( VipsImage *image ) vips_image_write_prepare( VipsImage *image )
{ {
g_assert( vips_object_sanity( VIPS_OBJECT( 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; image->Bbits = vips_format_sizeof( image->BandFmt ) << 3;
if( image->dtype == VIPS_IMAGE_PARTIAL ) { 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 ); "old-style output for %s\n", image->filename );
image->dtype = VIPS_IMAGE_SETBUF; 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? /* Is this the start of eval?
*/ */
if( ypos == 0 ) { if( ypos == 0 ) {
if( vips_image_wio_output( image ) ) if( vips__image_wio_output( image ) )
return( -1 ); return( -1 );
/* Always clear kill before we start looping. See the /* Always clear kill before we start looping. See the
* call to vips_image_get_kill() below. * call to vips_image_get_kill() below.
*/ */
vips_image_set_kill( image, FALSE ); vips_image_set_kill( image, FALSE );
vips__image_write_prepare( image ); vips_image_write_prepare( image );
vips_image_preeval( image ); vips_image_preeval( image );
} }
@ -2020,19 +2029,8 @@ vips_image_wio_input( VipsImage *image )
return( 0 ); 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 int
vips_image_wio_output( VipsImage *image ) vips__image_wio_output( VipsImage *image )
{ {
#ifdef DEBUG_IO #ifdef DEBUG_IO
printf( "vips_image_wio_output: WIO output for %s\n", 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 * We used to check that ->data was null and warn about
* writing twice, but we no longer insist that this is called * 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. * more.
*/ */
break; break;