it runs!
"vips im_avg poop.png" now works, amazing. Test a few more things before we merge back to master.
This commit is contained in:
parent
53f4eb7811
commit
fd26b098b7
33
TODO
33
TODO
@ -18,6 +18,39 @@
|
||||
|
||||
- remove im__handle_eval etc. from headers
|
||||
|
||||
- png read/write needs redoing:
|
||||
|
||||
http://www.libpng.org/pub/png/src/libpng-1.4.x-to-1.5.x-summary.txt
|
||||
|
||||
... the ability to directly access
|
||||
the main libpng control structures, png_struct and png_info, deprecated
|
||||
in earlier versions of libpng, has been completely removed from
|
||||
libpng 1.5.
|
||||
|
||||
argh
|
||||
|
||||
- sink.c, sinkdisc.c, sinkmemory.c all define this function:
|
||||
|
||||
static int
|
||||
sink_progress( void *a )
|
||||
{
|
||||
Sink *sink = (Sink *) a;
|
||||
|
||||
VIPS_DEBUG_MSG( "sink_progress: %d x %d\n",
|
||||
sink->tile_width, sink->tile_height );
|
||||
|
||||
/* Trigger any eval callbacks on our source image and
|
||||
* check for errors.
|
||||
*/
|
||||
vips_image_eval( sink->im,
|
||||
sink->tile_width, sink->tile_height );
|
||||
if( vips_image_get_kill( im ) )
|
||||
return( -1 );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
how dumb, common this up somehow
|
||||
|
||||
|
||||
- pre/post/close should be on VipsObject, not VipsImage
|
||||
|
@ -248,6 +248,7 @@ void vips_object_set_property( GObject *gobject,
|
||||
void vips_object_get_property( GObject *gobject,
|
||||
guint property_id, GValue *value, GParamSpec *pspec );
|
||||
|
||||
void vips_object_preclose( VipsObject *object );
|
||||
int vips_object_build( VipsObject *object );
|
||||
void vips_object_print_class( VipsObjectClass *klass );
|
||||
void vips_object_print( VipsObject *object );
|
||||
|
@ -155,10 +155,10 @@ extern "C" {
|
||||
#define im_image vips_image_new_from_memory
|
||||
#define im_binfile vips_image_new_from_file_raw
|
||||
#define im__open_temp vips_image_new_disc_temp
|
||||
#define im__test_kill( I ) (!vips_image_get_kill( I ))
|
||||
#define im__start_eval( I ) (vips_image_preeval( I ), !vips_image_get_kill( I ))
|
||||
#define im__test_kill( I ) (vips_image_get_kill( I ))
|
||||
#define im__start_eval( I ) (vips_image_preeval( I ), vips_image_get_kill( I ))
|
||||
#define im__handle_eval( I, W, H ) \
|
||||
(vips_image_eval( I, W, H ), !vips_image_get_kill( I ))
|
||||
(vips_image_eval( I, W, H ), vips_image_get_kill( I ))
|
||||
#define im__end_eval vips_image_posteval
|
||||
#define im_invalidate vips_image_invalidate_all
|
||||
#define im_isfile vips_image_isfile
|
||||
|
@ -422,6 +422,8 @@ vips_image_dispose( GObject *gobject )
|
||||
vips_object_print( VIPS_OBJECT( gobject ) );
|
||||
#endif /*VIPS_DEBUG*/
|
||||
|
||||
vips_object_preclose( VIPS_OBJECT( gobject ) );
|
||||
|
||||
G_OBJECT_CLASS( vips_image_parent_class )->dispose( gobject );
|
||||
}
|
||||
|
||||
@ -479,6 +481,8 @@ lazy_new( VipsImage *image,
|
||||
{
|
||||
Lazy *lazy;
|
||||
|
||||
VIPS_DEBUG_MSG( "lazy_new: \"%s\"\n", filename );
|
||||
|
||||
if( !(lazy = VIPS_NEW( image, Lazy )) )
|
||||
return( NULL );
|
||||
lazy->image = image;
|
||||
@ -827,6 +831,11 @@ vips_image_build( VipsObject *object )
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Make this a partial, generate into it from the
|
||||
* converter.
|
||||
*/
|
||||
image->dtype = VIPS_IMAGE_PARTIAL;
|
||||
|
||||
if( vips_image_open_lazy( image, format,
|
||||
filename, mode[1] == 'd' ) )
|
||||
return( -1 );
|
||||
@ -970,6 +979,9 @@ vips_image_class_init( VipsImageClass *class )
|
||||
gobject_class->set_property = vips_object_set_property;
|
||||
gobject_class->get_property = vips_object_get_property;
|
||||
|
||||
vobject_class->nickname = "image";
|
||||
vobject_class->description = _( "VIPS image class" );
|
||||
|
||||
vobject_class->print = vips_image_print;
|
||||
vobject_class->build = vips_image_build;
|
||||
|
||||
@ -1342,8 +1354,8 @@ vips_image_get_kill( VipsImage *image )
|
||||
void
|
||||
vips_image_set_kill( VipsImage *image, gboolean kill )
|
||||
{
|
||||
VIPS_DEBUG_MSG( "vips_image_set_kill: %s = %d\n",
|
||||
image->filename, kill );
|
||||
if( !image->kill )
|
||||
VIPS_DEBUG_MSG( "vips_image_set_kill: %s\n", image->filename );
|
||||
|
||||
image->kill = kill;
|
||||
}
|
||||
|
@ -30,8 +30,10 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
#define DEBUG
|
||||
*/
|
||||
#define DEBUG
|
||||
#define VIPS_DEBUG
|
||||
#define DEBUG_REF
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
@ -73,7 +75,7 @@ static guint vips_object_signals[SIG_LAST] = { 0 };
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE( VipsObject, vips_object, G_TYPE_OBJECT );
|
||||
|
||||
static void
|
||||
void
|
||||
vips_object_preclose( VipsObject *object )
|
||||
{
|
||||
if( !object->preclose ) {
|
||||
@ -152,7 +154,7 @@ vips_object_print( VipsObject *object )
|
||||
vips_object_print_class( class );
|
||||
vips_buf_init_static( &buf, str, 1000 );
|
||||
class->print( object, &buf );
|
||||
printf( "\n%s (%p)\n", vips_buf_all( &buf ), object );
|
||||
printf( "%s\n", vips_buf_all( &buf ) );
|
||||
}
|
||||
|
||||
/* Extra stuff we track for properties to do our argument handling.
|
||||
@ -394,9 +396,14 @@ vips_object_dispose( GObject *gobject )
|
||||
/* Our subclasses should have already called this. Run it again, just
|
||||
* in case.
|
||||
*/
|
||||
if( !object->preclose )
|
||||
if( !object->preclose ) {
|
||||
#ifdef VIPS_DEBUG
|
||||
printf( "vips_object_dispose: no vips_object_preclose()\n" );
|
||||
vips_object_preclose( object );
|
||||
vips_object_print( VIPS_OBJECT( gobject ) );
|
||||
#endif /*VIPS_DEBUG*/
|
||||
|
||||
vips_object_preclose( object );
|
||||
}
|
||||
|
||||
/* Clear all our arguments: they may be holding refs we should drop.
|
||||
*/
|
||||
|
@ -274,6 +274,8 @@ vips_region_dispose( GObject *gobject )
|
||||
vips_object_print( VIPS_OBJECT( gobject ) );
|
||||
#endif /*VIPS_DEBUG*/
|
||||
|
||||
vips_object_preclose( VIPS_OBJECT( gobject ) );
|
||||
|
||||
/* Stop this sequence.
|
||||
*/
|
||||
vips__region_stop( region );
|
||||
|
@ -290,11 +290,14 @@ sink_progress( void *a )
|
||||
{
|
||||
Sink *sink = (Sink *) a;
|
||||
|
||||
VIPS_DEBUG_MSG( "sink_progress: %d x %d\n",
|
||||
sink->tile_width, sink->tile_height );
|
||||
|
||||
/* Trigger any eval callbacks on our source image and
|
||||
* check for errors.
|
||||
*/
|
||||
if( im__handle_eval( sink->im,
|
||||
sink->tile_width, sink->tile_height ) )
|
||||
vips_image_eval( sink->im, sink->tile_width, sink->tile_height );
|
||||
if( vips_image_get_kill( sink->im ) )
|
||||
return( -1 );
|
||||
|
||||
return( 0 );
|
||||
@ -350,10 +353,7 @@ vips_sink_tile( VipsImage *im,
|
||||
sink.tile_height = tile_height;
|
||||
}
|
||||
|
||||
if( im__start_eval( sink.t ) ) {
|
||||
sink_free( &sink );
|
||||
return( -1 );
|
||||
}
|
||||
vips_image_preeval( sink.t );
|
||||
|
||||
result = vips_threadpool_run( im,
|
||||
sink_thread_state_new,
|
||||
@ -362,7 +362,7 @@ vips_sink_tile( VipsImage *im,
|
||||
sink_progress,
|
||||
&sink );
|
||||
|
||||
im__end_eval( sink.t );
|
||||
vips_image_posteval( sink.t );
|
||||
|
||||
sink_free( &sink );
|
||||
|
||||
|
@ -440,8 +440,8 @@ wbuffer_progress_fn( void *a )
|
||||
/* Trigger any eval callbacks on our source image and
|
||||
* check for errors.
|
||||
*/
|
||||
if( im__handle_eval( write->im,
|
||||
write->tile_width, write->tile_height ) )
|
||||
vips_image_eval( write->im, write->tile_width, write->tile_height );
|
||||
if( vips_image_get_kill( write->im ) )
|
||||
return( -1 );
|
||||
|
||||
return( 0 );
|
||||
@ -510,8 +510,7 @@ vips_sink_disc( VipsImage *im, VipsRegionWrite write_fn, void *a )
|
||||
Write write;
|
||||
int result;
|
||||
|
||||
if( im__start_eval( im ) )
|
||||
return( -1 );
|
||||
vips_image_preeval( im );
|
||||
|
||||
write_init( &write, im, write_fn, a );
|
||||
|
||||
@ -541,7 +540,7 @@ vips_sink_disc( VipsImage *im, VipsRegionWrite write_fn, void *a )
|
||||
if( !result )
|
||||
im_semaphore_down( &write.buf->done );
|
||||
|
||||
im__end_eval( im );
|
||||
vips_image_posteval( im );
|
||||
|
||||
write_free( &write );
|
||||
|
||||
|
@ -166,8 +166,8 @@ sink_progress( void *a )
|
||||
/* Trigger any eval callbacks on our source image and
|
||||
* check for errors.
|
||||
*/
|
||||
if( im__handle_eval( sink->im,
|
||||
sink->tile_width, sink->tile_height ) )
|
||||
vips_image_eval( sink->im, sink->tile_width, sink->tile_height );
|
||||
if( vips_image_get_kill( sink->im ) )
|
||||
return( -1 );
|
||||
|
||||
return( 0 );
|
||||
@ -200,10 +200,7 @@ vips_sink_memory( VipsImage *im )
|
||||
if( sink_init( &sink, im ) )
|
||||
return( -1 );
|
||||
|
||||
if( im__start_eval( im ) ) {
|
||||
sink_free( &sink );
|
||||
return( -1 );
|
||||
}
|
||||
vips_image_preeval( im );
|
||||
|
||||
result = vips_threadpool_run( im,
|
||||
vips_thread_state_new,
|
||||
@ -212,7 +209,7 @@ vips_sink_memory( VipsImage *im )
|
||||
sink_progress,
|
||||
&sink );
|
||||
|
||||
im__end_eval( im );
|
||||
vips_image_posteval( im );
|
||||
|
||||
sink_free( &sink );
|
||||
|
||||
|
@ -91,7 +91,8 @@ typedef struct {
|
||||
static void
|
||||
im_add_callback_cb( VipsImage *im, Callback *callback )
|
||||
{
|
||||
callback->fn( callback->a, callback->b );
|
||||
if( callback->fn( callback->a, callback->b ) )
|
||||
vips_image_set_kill( im, TRUE );
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -65,6 +65,7 @@
|
||||
|
||||
/*
|
||||
#define DEBUG_FATAL
|
||||
#define DEBUG_LEAK
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -78,6 +79,7 @@
|
||||
#include <locale.h>
|
||||
|
||||
#include <vips/vips.h>
|
||||
#include <vips/internal.h>
|
||||
|
||||
#ifdef OS_WIN32
|
||||
#define strcasecmp(a,b) _stricmp(a,b)
|
||||
@ -919,6 +921,10 @@ main( int argc, char **argv )
|
||||
fprintf( stderr, "*** DEBUG_FATAL: will abort() on first warning\n" );
|
||||
#endif /*!DEBUG_FATAL*/
|
||||
|
||||
#ifdef DEBUG_LEAK
|
||||
fprintf( stderr, "*** DEBUG_LEAK: will leak test on exit\n" );
|
||||
#endif /*!DEBUG_LEAK*/
|
||||
|
||||
context = g_option_context_new( _( "- VIPS driver program" ) );
|
||||
|
||||
g_option_context_add_main_entries( context,
|
||||
@ -1020,5 +1026,11 @@ main( int argc, char **argv )
|
||||
|
||||
im_close_plugins();
|
||||
|
||||
#ifdef DEBUG_LEAK
|
||||
printf( "** leak test on exit:\n" );
|
||||
im__print_all();
|
||||
printf( "** leak test done\n" );
|
||||
#endif /*DEBUG_LEAK*/
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user