cleanups ready for proto gen
This commit is contained in:
parent
b5cd4ac144
commit
070a437f61
|
@ -37,8 +37,9 @@
|
||||||
#include <vips/debug.h>
|
#include <vips/debug.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define DEBUG
|
|
||||||
*/
|
*/
|
||||||
|
#define VIPS_DEBUG
|
||||||
|
#define DEBUG
|
||||||
|
|
||||||
VIPS_NAMESPACE_START
|
VIPS_NAMESPACE_START
|
||||||
|
|
||||||
|
@ -62,6 +63,7 @@ VOption *VOption::set( const char *name, const char *value )
|
||||||
return( this );
|
return( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// input int ... this path is used for enums as well
|
||||||
VOption *VOption::set( const char *name, int value )
|
VOption *VOption::set( const char *name, int value )
|
||||||
{
|
{
|
||||||
Pair *pair = new Pair( name );
|
Pair *pair = new Pair( name );
|
||||||
|
@ -74,6 +76,7 @@ VOption *VOption::set( const char *name, int value )
|
||||||
return( this );
|
return( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// input image
|
||||||
VOption *VOption::set( const char *name, VImage value )
|
VOption *VOption::set( const char *name, VImage value )
|
||||||
{
|
{
|
||||||
Pair *pair = new Pair( name );
|
Pair *pair = new Pair( name );
|
||||||
|
@ -87,6 +90,7 @@ VOption *VOption::set( const char *name, VImage value )
|
||||||
return( this );
|
return( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// output image
|
||||||
VOption *VOption::set( const char *name, VImage *value )
|
VOption *VOption::set( const char *name, VImage *value )
|
||||||
{
|
{
|
||||||
Pair *pair = new Pair( name );
|
Pair *pair = new Pair( name );
|
||||||
|
@ -108,12 +112,14 @@ void VOption::set_operation( VipsOperation *operation )
|
||||||
|
|
||||||
for( i = options.begin(); i != options.end(); i++ )
|
for( i = options.begin(); i != options.end(); i++ )
|
||||||
if( (*i)->input ) {
|
if( (*i)->input ) {
|
||||||
|
#ifdef DEBUG
|
||||||
printf( "set_operation: " );
|
printf( "set_operation: " );
|
||||||
vips_object_print_name( VIPS_OBJECT( operation ) );
|
vips_object_print_name( VIPS_OBJECT( operation ) );
|
||||||
char *str_value =
|
char *str_value =
|
||||||
g_strdup_value_contents( &(*i)->value );
|
g_strdup_value_contents( &(*i)->value );
|
||||||
printf( ".%s = %s\n", (*i)->name, str_value );
|
printf( ".%s = %s\n", (*i)->name, str_value );
|
||||||
g_free( str_value );
|
g_free( str_value );
|
||||||
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
g_object_set_property( G_OBJECT( operation ),
|
g_object_set_property( G_OBJECT( operation ),
|
||||||
(*i)->name, &(*i)->value );
|
(*i)->name, &(*i)->value );
|
||||||
|
@ -130,12 +136,14 @@ void VOption::get_operation( VipsOperation *operation )
|
||||||
g_object_get_property( G_OBJECT( operation ),
|
g_object_get_property( G_OBJECT( operation ),
|
||||||
(*i)->name, &(*i)->value );
|
(*i)->name, &(*i)->value );
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
printf( "get_operation: " );
|
printf( "get_operation: " );
|
||||||
vips_object_print_name( VIPS_OBJECT( operation ) );
|
vips_object_print_name( VIPS_OBJECT( operation ) );
|
||||||
char *str_value =
|
char *str_value =
|
||||||
g_strdup_value_contents( &(*i)->value );
|
g_strdup_value_contents( &(*i)->value );
|
||||||
printf( ".%s = %s\n", (*i)->name, str_value );
|
printf( ".%s = %s\n", (*i)->name, str_value );
|
||||||
g_free( str_value );
|
g_free( str_value );
|
||||||
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
// rebox object
|
// rebox object
|
||||||
VipsImage *image = VIPS_IMAGE(
|
VipsImage *image = VIPS_IMAGE(
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define DEBUG
|
||||||
|
|
||||||
#include <vips/vips8>
|
#include <vips/vips8>
|
||||||
|
|
||||||
using namespace vips8;
|
using namespace vips8;
|
||||||
|
@ -40,7 +42,9 @@ main( int argc, char **argv )
|
||||||
printf( "sizeof( VImage ) = %zd\n", sizeof( VImage ) );
|
printf( "sizeof( VImage ) = %zd\n", sizeof( VImage ) );
|
||||||
|
|
||||||
{
|
{
|
||||||
VImage in = VImage::new_from_file( argv[1] );
|
VImage in = VImage::new_from_file( argv[1],
|
||||||
|
VImage::option()->set( "access", VIPS_ACCESS_SEQUENTIAL_UNBUFFERED ) );
|
||||||
|
|
||||||
VImage out;
|
VImage out;
|
||||||
|
|
||||||
out = in.invert();
|
out = in.invert();
|
||||||
|
|
|
@ -60,6 +60,7 @@ public:
|
||||||
g_assert( !new_vobject ||
|
g_assert( !new_vobject ||
|
||||||
VIPS_IS_OBJECT( new_vobject ) );
|
VIPS_IS_OBJECT( new_vobject ) );
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
printf( "VObject constructor, obj = %p, steal = %d\n",
|
printf( "VObject constructor, obj = %p, steal = %d\n",
|
||||||
new_vobject, steal );
|
new_vobject, steal );
|
||||||
if( new_vobject ) {
|
if( new_vobject ) {
|
||||||
|
@ -67,8 +68,12 @@ public:
|
||||||
vips_object_print_name( VIPS_OBJECT( new_vobject ) );
|
vips_object_print_name( VIPS_OBJECT( new_vobject ) );
|
||||||
printf( "\n" );
|
printf( "\n" );
|
||||||
}
|
}
|
||||||
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
if( !steal ) {
|
if( !steal ) {
|
||||||
|
#ifdef DEBUG
|
||||||
printf( " reffing object\n" );
|
printf( " reffing object\n" );
|
||||||
|
#endif /*DEBUG*/
|
||||||
g_object_ref( vobject );
|
g_object_ref( vobject );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,10 +89,12 @@ public:
|
||||||
{
|
{
|
||||||
g_assert( VIPS_IS_OBJECT( a.vobject ) );
|
g_assert( VIPS_IS_OBJECT( a.vobject ) );
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
printf( "VObject copy constructor, obj = %p\n",
|
printf( "VObject copy constructor, obj = %p\n",
|
||||||
vobject );
|
vobject );
|
||||||
g_object_ref( vobject );
|
|
||||||
printf( " reffing object\n" );
|
printf( " reffing object\n" );
|
||||||
|
#endif /*DEBUG*/
|
||||||
|
g_object_ref( vobject );
|
||||||
}
|
}
|
||||||
|
|
||||||
// assignment ... we must delete the old ref
|
// assignment ... we must delete the old ref
|
||||||
|
@ -96,9 +103,11 @@ public:
|
||||||
{
|
{
|
||||||
VipsObject *old_vobject;
|
VipsObject *old_vobject;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
printf( "VObject assignment\n" );
|
printf( "VObject assignment\n" );
|
||||||
printf( " reffing %p\n", a.vobject );
|
printf( " reffing %p\n", a.vobject );
|
||||||
printf( " unreffing %p\n", vobject );
|
printf( " unreffing %p\n", vobject );
|
||||||
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
g_assert( !vobject ||
|
g_assert( !vobject ||
|
||||||
VIPS_IS_OBJECT( vobject ) );
|
VIPS_IS_OBJECT( vobject ) );
|
||||||
|
@ -120,8 +129,10 @@ public:
|
||||||
// no vtable allowed
|
// no vtable allowed
|
||||||
~VObject()
|
~VObject()
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
printf( "VObject destructor\n" );
|
printf( "VObject destructor\n" );
|
||||||
printf( " unreffing %p\n", vobject );
|
printf( " unreffing %p\n", vobject );
|
||||||
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
g_assert( !vobject ||
|
g_assert( !vobject ||
|
||||||
VIPS_IS_OBJECT( vobject ) );
|
VIPS_IS_OBJECT( vobject ) );
|
||||||
|
|
Loading…
Reference in New Issue