Merge remote-tracking branch 'origin/7.28'
Conflicts: libvips/iofuncs/object.c
This commit is contained in:
commit
3de5ec9078
@ -8,6 +8,7 @@
|
|||||||
19/4/12 started 7.28.6
|
19/4/12 started 7.28.6
|
||||||
- better resolution unit handling in deprecated im_vips2tiff()
|
- better resolution unit handling in deprecated im_vips2tiff()
|
||||||
- use TIFF_CFLAGS output from pkg-config (thanks Jay)
|
- use TIFF_CFLAGS output from pkg-config (thanks Jay)
|
||||||
|
- much faster vips_argument_map()
|
||||||
|
|
||||||
19/4/12 started 7.28.5
|
19/4/12 started 7.28.5
|
||||||
- ifthenelse blend mode was broken
|
- ifthenelse blend mode was broken
|
||||||
|
@ -328,15 +328,8 @@ int vips_object_get_argument_priority( VipsObject *object, const char *name );
|
|||||||
VipsArgumentInstance *ARG_INSTANCE = \
|
VipsArgumentInstance *ARG_INSTANCE = \
|
||||||
vips__argument_get_instance( argument_class, \
|
vips__argument_get_instance( argument_class, \
|
||||||
VIPS_OBJECT( OBJECT ) ); \
|
VIPS_OBJECT( OBJECT ) ); \
|
||||||
\
|
|
||||||
/* We have many props on the arg table ... filter out the \
|
|
||||||
* ones for this class. \
|
|
||||||
*/ \
|
|
||||||
if( g_object_class_find_property( \
|
|
||||||
G_OBJECT_CLASS( object_class ), \
|
|
||||||
g_param_spec_get_name( PSPEC ) ) == PSPEC ) {
|
|
||||||
|
|
||||||
#define VIPS_ARGUMENT_FOR_ALL_END } } }
|
#define VIPS_ARGUMENT_FOR_ALL_END } }
|
||||||
|
|
||||||
/* And some macros to collect args from a va list.
|
/* And some macros to collect args from a va list.
|
||||||
*/
|
*/
|
||||||
@ -494,13 +487,22 @@ struct _VipsObjectClass {
|
|||||||
*/
|
*/
|
||||||
const char *description;
|
const char *description;
|
||||||
|
|
||||||
/* Table of arguments for this class and any derived classes. Order
|
/* Hash from pspec to VipsArgumentClass.
|
||||||
* is important, so keep a traverse list too. We can't rely on the
|
*
|
||||||
* ordering given by g_object_class_list_properties() since it comes
|
* This records the VipsArgumentClass for every pspec used in
|
||||||
* from a hash :-(
|
* VipsObject and any subclass (ie. everywhere), so it's huge. Don't
|
||||||
|
* loop over this hash! Fine for lookups though.
|
||||||
*/
|
*/
|
||||||
VipsArgumentTable *argument_table;
|
VipsArgumentTable *argument_table;
|
||||||
|
|
||||||
|
/* A sorted (by priority) list of the VipsArgumentClass for this class
|
||||||
|
* and any superclasses. This is small and specific to this class.
|
||||||
|
*
|
||||||
|
* Use the stored GType to work out when to restart the list for a
|
||||||
|
* subclass.
|
||||||
|
*/
|
||||||
GSList *argument_table_traverse;
|
GSList *argument_table_traverse;
|
||||||
|
GType argument_table_traverse_gtype;
|
||||||
};
|
};
|
||||||
|
|
||||||
gboolean vips_value_is_null( GParamSpec *psoec, const GValue *value );
|
gboolean vips_value_is_null( GParamSpec *psoec, const GValue *value );
|
||||||
|
@ -357,33 +357,20 @@ vips_argument_map( VipsObject *object,
|
|||||||
*/
|
*/
|
||||||
g_object_ref( object );
|
g_object_ref( object );
|
||||||
|
|
||||||
/* We only get called after all the VipsArgumentInstance have been
|
VIPS_ARGUMENT_FOR_ALL( object,
|
||||||
* built. We can often skip the pspec lookup.
|
pspec, argument_class, argument_instance ) {
|
||||||
*/
|
void *result;
|
||||||
for( p = object_class->argument_table_traverse; p; p = p->next ) {
|
|
||||||
VipsArgumentClass *argument_class =
|
|
||||||
(VipsArgumentClass *) p->data;
|
|
||||||
VipsArgument *argument = (VipsArgument *) argument_class;
|
|
||||||
GParamSpec *pspec = argument->pspec;
|
|
||||||
VipsArgumentInstance *argument_instance =
|
|
||||||
vips__argument_get_instance( argument_class, object );
|
|
||||||
|
|
||||||
/* We have many props on the arg table ... filter out the
|
/* argument_instance should not be NULL.
|
||||||
* ones for this class.
|
*/
|
||||||
*/
|
g_assert( argument_instance );
|
||||||
if( argument_instance &&
|
|
||||||
g_object_class_find_property(
|
|
||||||
G_OBJECT_CLASS( object_class ),
|
|
||||||
g_param_spec_get_name( pspec ) ) == pspec ) {
|
|
||||||
void *result;
|
|
||||||
|
|
||||||
if( (result = fn( object, pspec,
|
if( (result = fn( object, pspec,
|
||||||
argument_class, argument_instance, a, b )) ) {
|
argument_class, argument_instance, a, b )) ) {
|
||||||
g_object_unref( object );
|
g_object_unref( object );
|
||||||
return( result );
|
return( result );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref( object );
|
g_object_unref( object );
|
||||||
|
|
||||||
@ -406,19 +393,12 @@ vips_argument_class_map( VipsObjectClass *object_class,
|
|||||||
(VipsArgumentClass *) p->data;
|
(VipsArgumentClass *) p->data;
|
||||||
VipsArgument *argument = (VipsArgument *) arg_class;
|
VipsArgument *argument = (VipsArgument *) arg_class;
|
||||||
GParamSpec *pspec = argument->pspec;
|
GParamSpec *pspec = argument->pspec;
|
||||||
|
|
||||||
/* We have many props on the arg table ... filter out the
|
|
||||||
* ones for this class.
|
|
||||||
*/
|
|
||||||
if( g_object_class_find_property(
|
|
||||||
G_OBJECT_CLASS( object_class ),
|
|
||||||
g_param_spec_get_name( pspec ) ) == pspec ) {
|
|
||||||
void *result;
|
|
||||||
|
|
||||||
if( (result =
|
void *result;
|
||||||
fn( object_class, pspec, arg_class, a, b )) )
|
|
||||||
return( result );
|
if( (result =
|
||||||
}
|
fn( object_class, pspec, arg_class, a, b )) )
|
||||||
|
return( result );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( NULL );
|
return( NULL );
|
||||||
@ -767,6 +747,10 @@ vips_object_dispose( GObject *gobject )
|
|||||||
/* Our subclasses should have already called this. Run it again, just
|
/* Our subclasses should have already called this. Run it again, just
|
||||||
* in case.
|
* in case.
|
||||||
*/
|
*/
|
||||||
|
#ifdef DEBUG
|
||||||
|
if( !object->preclose )
|
||||||
|
printf( "vips_object_dispose: pre-close missing!\n" );
|
||||||
|
#endif /*DEBUG*/
|
||||||
vips_object_preclose( object );
|
vips_object_preclose( object );
|
||||||
|
|
||||||
/* Clear all our arguments: they may be holding resources we should
|
/* Clear all our arguments: they may be holding resources we should
|
||||||
@ -1387,7 +1371,8 @@ vips_object_class_install_argument( VipsObjectClass *object_class,
|
|||||||
VipsArgumentClass *argument_class = g_new( VipsArgumentClass, 1 );
|
VipsArgumentClass *argument_class = g_new( VipsArgumentClass, 1 );
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf( "vips_object_class_install_argument: %s %s\n",
|
printf( "vips_object_class_install_argument: %p %s %s\n",
|
||||||
|
object_class,
|
||||||
g_type_name( G_TYPE_FROM_CLASS( object_class ) ),
|
g_type_name( G_TYPE_FROM_CLASS( object_class ) ),
|
||||||
g_param_spec_get_name( pspec ) );
|
g_param_spec_get_name( pspec ) );
|
||||||
#endif /*DEBUG*/
|
#endif /*DEBUG*/
|
||||||
@ -1411,10 +1396,46 @@ vips_object_class_install_argument( VipsObjectClass *object_class,
|
|||||||
|
|
||||||
vips_argument_table_replace( object_class->argument_table,
|
vips_argument_table_replace( object_class->argument_table,
|
||||||
(VipsArgument *) argument_class );
|
(VipsArgument *) argument_class );
|
||||||
|
|
||||||
|
/* If this is the first argument for a new subclass, we need to clone
|
||||||
|
* the traverse list we inherit.
|
||||||
|
*/
|
||||||
|
if( object_class->argument_table_traverse_gtype !=
|
||||||
|
G_TYPE_FROM_CLASS( object_class ) ) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf( "vips_object_class_install_argument: "
|
||||||
|
"cloning traverse\n" );
|
||||||
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
|
object_class->argument_table_traverse =
|
||||||
|
g_slist_copy( object_class->argument_table_traverse );
|
||||||
|
object_class->argument_table_traverse_gtype =
|
||||||
|
G_TYPE_FROM_CLASS( object_class );
|
||||||
|
}
|
||||||
|
|
||||||
object_class->argument_table_traverse = g_slist_prepend(
|
object_class->argument_table_traverse = g_slist_prepend(
|
||||||
object_class->argument_table_traverse, argument_class );
|
object_class->argument_table_traverse, argument_class );
|
||||||
object_class->argument_table_traverse = g_slist_sort(
|
object_class->argument_table_traverse = g_slist_sort(
|
||||||
object_class->argument_table_traverse, traverse_sort );
|
object_class->argument_table_traverse, traverse_sort );
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
{
|
||||||
|
GSList *p;
|
||||||
|
|
||||||
|
printf( "%d items on traverse %p\n",
|
||||||
|
g_slist_length( object_class->argument_table_traverse ),
|
||||||
|
&object_class->argument_table_traverse );
|
||||||
|
for( p = object_class->argument_table_traverse; p; p = p->next ) {
|
||||||
|
VipsArgumentClass *argument_class =
|
||||||
|
(VipsArgumentClass *) p->data;
|
||||||
|
|
||||||
|
printf( "\t%p %s\n",
|
||||||
|
argument_class,
|
||||||
|
g_param_spec_get_name(
|
||||||
|
((VipsArgument *) argument_class)->pspec ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /*DEBUG*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set a named arg from a string.
|
/* Set a named arg from a string.
|
||||||
|
Loading…
Reference in New Issue
Block a user