rename some _get funcs

all the _get_ funcs that returned a bool have become _isthing()
functions, eg.

vips_object_argument_get_assigned() ->
  vips_object_argument_isset()
This commit is contained in:
John Cupitt 2012-11-09 13:08:59 +00:00
parent d5a1d65183
commit 8f364a8b51
18 changed files with 43 additions and 47 deletions

15
TODO
View File

@ -1,18 +1,17 @@
- rename
- quadratic doesn't work for order 3
gboolean vips_object_get_argument_assigned( VipsObject *, const char * )
start to get jaggies on lines --- the 3rd differential isn't being
initialised correctly for the sub-region?
as
seems fine vertically, only get horizontal in tile boundaries
gboolean vips_object_argument_isassigned( VipsObject *, const char * )
- seems to leak with vips_check_matrix()?
hmm or maybe
- use interpolate arg if set
gboolean vips_object_isset( VipsObject *, const char * )
- perhaps keep inline bilinear as an option? benchmark
cf. g_object_set()
any other object_get funcs that return gboolean? they should change too
- the operation cache needs to detect invalidate

View File

@ -443,7 +443,7 @@ vips_arithmetic_get_vector( VipsArithmeticClass *class, VipsBandFormat fmt )
{
g_assert( fmt >= 0 && fmt < VIPS_FORMAT_LAST );
if( !vips_vector_get_enabled() ||
if( !vips_vector_isenabled() ||
!class->vector_program[fmt] )
return( NULL );

View File

@ -112,11 +112,11 @@ vips_measure_build( VipsObject *object )
/* left/top/width/height default to the size of the image.
*/
if( !vips_object_get_argument_assigned( object, "width" ) )
if( !vips_object_argument_isset( object, "width" ) )
g_object_set( object,
"width", vips_image_get_width( measure->in ),
NULL );
if( !vips_object_get_argument_assigned( object, "height" ) )
if( !vips_object_argument_isset( object, "height" ) )
g_object_set( object,
"height", vips_image_get_height( measure->in ),
NULL );

View File

@ -348,8 +348,8 @@ vips_embed_build( VipsObject *object )
embed->background->data, embed->background->n )) )
return( -1 );
if( !vips_object_get_argument_assigned( object, "extend" ) &&
vips_object_get_argument_assigned( object, "background" ) )
if( !vips_object_argument_isset( object, "extend" ) &&
vips_object_argument_isset( object, "background" ) )
embed->extend = VIPS_EXTEND_BACKGROUND;
switch( embed->extend ) {

View File

@ -524,7 +524,7 @@ conv_new( IMAGE *in, IMAGE *out, INTMASK *mask )
/* Generate code for this mask / image, if possible.
*/
if( vips_vector_get_enabled() ) {
if( vips_vector_isenabled() ) {
if( conv_compile_convolution_u8s16( conv ) ||
conv_compile_scale_s16u8( conv ) )
conv_vector_free( conv );
@ -608,7 +608,7 @@ conv_start( IMAGE *out, void *a, void *b )
return( NULL );
}
if( vips_vector_get_enabled() &&
if( vips_vector_isenabled() &&
conv->n_pass ) {
seq->t1 = IM_ARRAY( NULL, IM_IMAGE_N_ELEMENTS( in ), short );
seq->t2 = IM_ARRAY( NULL, IM_IMAGE_N_ELEMENTS( in ), short );

View File

@ -1040,9 +1040,9 @@ vips_foreign_save_dz_build( VipsObject *object )
*/
if( dz->layout == VIPS_FOREIGN_DZ_LAYOUT_ZOOMIFY ||
dz->layout == VIPS_FOREIGN_DZ_LAYOUT_GOOGLE ) {
if( !vips_object_get_argument_assigned( object, "overlap" ) )
if( !vips_object_argument_isset( object, "overlap" ) )
dz->overlap = 0;
if( !vips_object_get_argument_assigned( object, "suffix" ) )
if( !vips_object_argument_isset( object, "suffix" ) )
VIPS_SETSTR( dz->suffix, ".jpg" );
}
@ -1058,11 +1058,11 @@ vips_foreign_save_dz_build( VipsObject *object )
* tile.
*/
if( dz->layout == VIPS_FOREIGN_DZ_LAYOUT_DZ ) {
if( !vips_object_get_argument_assigned( object, "depth" ) )
if( !vips_object_argument_isset( object, "depth" ) )
dz->depth = VIPS_FOREIGN_DZ_DEPTH_1PIXEL;
}
else
if( !vips_object_get_argument_assigned( object, "depth" ) )
if( !vips_object_argument_isset( object, "depth" ) )
dz->depth = VIPS_FOREIGN_DZ_DEPTH_1TILE;
if( VIPS_OBJECT_CLASS( vips_foreign_save_dz_parent_class )->

View File

@ -95,14 +95,14 @@ vips_foreign_save_tiff_build( VipsObject *object )
/* Default xres/yres to the values from the image.
*/
if( !vips_object_get_argument_assigned( object, "xres" ) )
if( !vips_object_argument_isset( object, "xres" ) )
tiff->xres = save->ready->Xres * 10.0;
if( !vips_object_get_argument_assigned( object, "yres" ) )
if( !vips_object_argument_isset( object, "yres" ) )
tiff->yres = save->ready->Yres * 10.0;
/* resunit param overrides resunit metadata.
*/
if( !vips_object_get_argument_assigned( object, "resunit" ) &&
if( !vips_object_argument_isset( object, "resunit" ) &&
vips_image_get_typeof( save->ready,
VIPS_META_RESOLUTION_UNIT ) &&
!vips_image_get_string( save->ready,

View File

@ -492,7 +492,7 @@ void vips_image_eval( VipsImage *image, guint64 processed );
void vips_image_posteval( VipsImage *image );
void vips_image_set_progress( VipsImage *image, gboolean progress );
gboolean vips_image_get_kill( VipsImage *image );
gboolean vips_image_iskilled( VipsImage *image );
void vips_image_set_kill( VipsImage *image, gboolean kill );
VipsImage *vips_image_new( void );

View File

@ -325,8 +325,7 @@ int vips_object_get_argument( VipsObject *object, const char *name,
GParamSpec **pspec,
VipsArgumentClass **argument_class,
VipsArgumentInstance **argument_instance );
gboolean vips_object_get_argument_assigned( VipsObject *object,
const char *name );
gboolean vips_object_argument_isset( VipsObject *object, const char *name );
VipsArgumentFlags vips_object_get_argument_flags( VipsObject *object,
const char *name );
int vips_object_get_argument_priority( VipsObject *object, const char *name );
@ -572,7 +571,7 @@ void vips_object_class_install_argument( VipsObjectClass *, GParamSpec *pspec,
VipsArgumentFlags flags, int priority, guint offset );
int vips_object_set_argument_from_string( VipsObject *object,
const char *name, const char *value );
gboolean vips_object_get_argument_needs_string( VipsObject *object,
gboolean vips_object_argument_needsstring( VipsObject *object,
const char *name );
int vips_object_get_argument_to_string( VipsObject *object,
const char *name, const char *arg );

View File

@ -100,7 +100,7 @@ typedef struct {
extern gboolean vips__vector_enabled;
void vips_vector_init( void );
gboolean vips_vector_get_enabled( void );
gboolean vips_vector_isenabled( void );
void vips_vector_set_enabled( gboolean enabled );
void vips_vector_free( VipsVector *vector );

View File

@ -1280,7 +1280,7 @@ vips_image_set_progress( VipsImage *image, gboolean progress )
}
gboolean
vips_image_get_kill( VipsImage *image )
vips_image_iskilled( VipsImage *image )
{
gboolean kill;
@ -1289,7 +1289,7 @@ vips_image_get_kill( VipsImage *image )
/* Has kill been set for this image? If yes, abort evaluation.
*/
if( image->kill ) {
VIPS_DEBUG_MSG( "vips_image_get_kill: %s (%p) killed\n",
VIPS_DEBUG_MSG( "vips_image_iskilled: %s (%p) killed\n",
image->filename, image );
vips_error( "VipsImage",
_( "killed for image \"%s\"" ), image->filename );
@ -1938,7 +1938,7 @@ vips_image_write_line( VipsImage *image, int ypos, VipsPel *linebuffer )
return( -1 );
/* Always clear kill before we start looping. See the
* call to vips_image_get_kill() below.
* call to vips_image_iskilled() below.
*/
vips_image_set_kill( image, FALSE );
vips_image_write_prepare( image );
@ -1972,7 +1972,7 @@ vips_image_write_line( VipsImage *image, int ypos, VipsPel *linebuffer )
/* Trigger evaluation callbacks for this image.
*/
vips_image_eval( image, ypos * image->Xsize );
if( vips_image_get_kill( image ) )
if( vips_image_iskilled( image ) )
return( -1 );
/* Is this the end of eval?

View File

@ -524,7 +524,7 @@ vips_object_get_argument( VipsObject *object, const char *name,
}
/**
* vips_object_get_argument_assigned:
* vips_object_argument_isset:
* @object: the object to fetch the args from
* @name: arg to fetch
*
@ -533,7 +533,7 @@ vips_object_get_argument( VipsObject *object, const char *name,
* Returns: %TRUE if the argument has been assigned.
*/
gboolean
vips_object_get_argument_assigned( VipsObject *object, const char *name )
vips_object_argument_isset( VipsObject *object, const char *name )
{
GParamSpec *pspec;
VipsArgumentClass *argument_class;
@ -1639,7 +1639,7 @@ vips_object_set_argument_from_string( VipsObject *object,
* output needs a filename, a double output just prints.
*/
gboolean
vips_object_get_argument_needs_string( VipsObject *object, const char *name )
vips_object_argument_needsstring( VipsObject *object, const char *name )
{
GParamSpec *pspec;
GType otype;
@ -1648,7 +1648,7 @@ vips_object_get_argument_needs_string( VipsObject *object, const char *name )
VipsObjectClass *oclass;
#ifdef DEBUG
printf( "vips_object_get_argument_needs_string: %s\n", name );
printf( "vips_object_argument_needsstring: %s\n", name );
#endif /*DEBUG*/
if( vips_object_get_argument( object, name,

View File

@ -772,7 +772,7 @@ vips_call_options_add( VipsObject *object,
!argument_instance->assigned ) {
const char *name = g_param_spec_get_name( pspec );
gboolean needs_string =
vips_object_get_argument_needs_string( object, name );
vips_object_argument_needsstring( object, name );
GOptionEntry entry[2];
entry[0].long_name = name;
@ -858,8 +858,7 @@ vips_call_argv_input( VipsObject *object,
call->i += 1;
}
else if( (argument_class->flags & VIPS_ARGUMENT_OUTPUT) ) {
if( vips_object_get_argument_needs_string( object,
name ) )
if( vips_object_argument_needsstring( object, name ) )
call->i += 1;
}
}
@ -888,8 +887,7 @@ vips_call_argv_output( VipsObject *object,
const char *arg;
arg = NULL;
if( vips_object_get_argument_needs_string( object,
name ) ) {
if( vips_object_argument_needsstring( object, name ) ) {
arg = vips_call_get_arg( call, call->i );
if( !arg )
return( pspec );

View File

@ -1055,7 +1055,7 @@ vips_region_prepare( VipsRegion *reg, VipsRect *r )
vips__region_check_ownership( reg );
if( vips_image_get_kill( im ) )
if( vips_image_iskilled( im ) )
return( -1 );
/* We use save for sanity checking valid: we test at the end that the
@ -1189,7 +1189,7 @@ vips_region_prepare_to( VipsRegion *reg,
VipsRect clipped2;
VipsRect final;
if( vips_image_get_kill( im ) )
if( vips_image_iskilled( im ) )
return( -1 );
/* Sanity check.

View File

@ -200,7 +200,7 @@ void
vips_sink_base_init( SinkBase *sink_base, VipsImage *image )
{
/* Always clear kill before we start looping. See the
* call to vips_image_get_kill() below.
* call to vips_image_iskilled() below.
*/
vips_image_set_kill( image, FALSE );
@ -317,7 +317,7 @@ vips_sink_base_progress( void *a )
* check for errors.
*/
vips_image_eval( sink_base->im, sink_base->processed );
if( vips_image_get_kill( sink_base->im ) )
if( vips_image_iskilled( sink_base->im ) )
return( -1 );
return( 0 );

View File

@ -82,7 +82,7 @@ vips_vector_init( void )
}
gboolean
vips_vector_get_enabled( void )
vips_vector_isenabled( void )
{
#ifdef HAVE_ORC
return( vips__vector_enabled );

View File

@ -333,7 +333,7 @@ morph_new( IMAGE *in, IMAGE *out, INTMASK *mask, MorphOp op )
/* Generate code for this mask / image, if possible.
*/
if( vips_vector_get_enabled() ) {
if( vips_vector_isenabled() ) {
if( pass_compile( morph ) )
pass_free( morph );
}

View File

@ -276,7 +276,7 @@ vips_quadratic_build( VipsObject *object )
/* Default to "bilinear".
*/
if( !vips_object_get_argument_assigned( object, "interpolate" ) )
if( !vips_object_argument_isset( object, "interpolate" ) )
g_object_set( object,
"interpolate", vips_interpolate_new( "bilinear" ),
NULL );