diff --git a/libvips/include/vips/image.h b/libvips/include/vips/image.h index 353dc5e2..301df54b 100644 --- a/libvips/include/vips/image.h +++ b/libvips/include/vips/image.h @@ -271,7 +271,6 @@ const char *im_guess_prefix( const char *, const char * ); const char *im_guess_libdir( const char *, const char * ); VipsImage *im_open( const char *filename, const char *mode ); -int im_close( VipsImage *im ); /** * im_open_local: @@ -329,6 +328,10 @@ int im_close( VipsImage *im ); (im_construct_fn) im_open, (im_callback_fn) im_close, \ (void *) (NAME), (void *) (MODE), NULL )) +int im_close( VipsImage *im ); + +void im_invalidate( IMAGE *im ); + #ifdef __cplusplus } #endif /*__cplusplus*/ diff --git a/libvips/include/vips/private.h b/libvips/include/vips/private.h index 8ce1afd5..b07e5a8e 100644 --- a/libvips/include/vips/private.h +++ b/libvips/include/vips/private.h @@ -82,6 +82,53 @@ typedef struct { size_t length; /* Size of window */ } im_window_t; +/* window manager. + */ +im_window_t *im_window_ref( IMAGE *im, int top, int height ); +int im_window_unref( im_window_t *window ); +void im_window_print( im_window_t *window ); + +/* Per-thread buffer cache. Held in a GPrivate. + */ +typedef struct im__buffer_cache_t { + GHashTable *hash; /* Hash to im_buffer_cache_list_t* */ + GThread *thread; /* Just for sanity checking */ +} im_buffer_cache_t; + +/* Per-image buffer cache. Hash to this from im_buffer_cache_t. + * We can't store the GSList directly in the hash table, as GHashTable lacks an + * update operation and we'd need to _remove() and _insert() on every list + * operation. + */ +typedef struct im__buffer_cache_list_t { + GSList *buffers; /* GSList of im_buffer_t* */ + GThread *thread; /* Just for sanity checking */ + struct _VipsImage *im; + im_buffer_cache_t *cache; +} im_buffer_cache_list_t; + +/* What we track for each pixel buffer. + */ +typedef struct im__buffer_t { + int ref_count; /* # of regions referencing us */ + struct _VipsImage *im; /* IMAGE we are attached to */ + + Rect area; /* Area this pixel buffer covers */ + gboolean done; /* Calculated and in cache */ + im_buffer_cache_t *cache; + gboolean invalid; /* Needs to be recalculated */ + char *buf; /* Private malloc() area */ + size_t bsize; /* Size of private malloc() */ +} im_buffer_t; + +void im_buffer_done( im_buffer_t *buffer ); +void im_buffer_undone( im_buffer_t *buffer ); +void im_buffer_unref( im_buffer_t *buffer ); +im_buffer_t *im_buffer_ref( struct _VipsImage *im, Rect *area ); +im_buffer_t *im_buffer_unref_ref( im_buffer_t *buffer, + struct _VipsImage *im, Rect *area ); +void im_buffer_print( im_buffer_t *buffer ); + #ifdef __cplusplus } #endif /*__cplusplus*/ diff --git a/libvips/include/vips/region.h b/libvips/include/vips/region.h index 6c4cfb1f..7c98703d 100644 --- a/libvips/include/vips/region.h +++ b/libvips/include/vips/region.h @@ -36,45 +36,6 @@ extern "C" { #endif /*__cplusplus*/ -/* Profiling madness only, who cares about portability. - */ -#ifdef TIME_THREAD -#include -#endif /*TIME_THREAD*/ - -/* Per-thread buffer cache. Held in a GPrivate. - */ -typedef struct im__buffer_cache_t { - GHashTable *hash; /* Hash to im_buffer_cache_list_t* */ - GThread *thread; /* Just for sanity checking */ -} im_buffer_cache_t; - -/* Per-image buffer cache. Hash to this from im_buffer_cache_t. - * We can't store the GSList directly in the hash table, as GHashTable lacks an - * update operation and we'd need to _remove() and _insert() on every list - * operation. - */ -typedef struct im__buffer_cache_list_t { - GSList *buffers; /* GSList of im_buffer_t* */ - GThread *thread; /* Just for sanity checking */ - IMAGE *im; - im_buffer_cache_t *cache; -} im_buffer_cache_list_t; - -/* What we track for each pixel buffer. - */ -typedef struct im__buffer_t { - int ref_count; /* # of regions referencing us */ - IMAGE *im; /* IMAGE we are attached to */ - - Rect area; /* Area this pixel buffer covers */ - gboolean done; /* Calculated and in cache */ - im_buffer_cache_t *cache; - gboolean invalid; /* Needs to be recalculated */ - char *buf; /* Private malloc() area */ - size_t bsize; /* Size of private malloc() */ -} im_buffer_t; - /* Region types. */ typedef enum region_type { @@ -196,22 +157,6 @@ int im_wrapmany( IMAGE **in, IMAGE *out, int im__call_start( REGION *reg ); void im__call_stop( REGION *reg ); -/* window manager. - */ -im_window_t *im_window_ref( IMAGE *im, int top, int height ); -int im_window_unref( im_window_t *window ); -void im_window_print( im_window_t *window ); - -/* buffer manager. - */ -void im_buffer_done( im_buffer_t *buffer ); -void im_buffer_undone( im_buffer_t *buffer ); -void im_buffer_unref( im_buffer_t *buffer ); -im_buffer_t *im_buffer_ref( IMAGE *im, Rect *area ); -im_buffer_t *im_buffer_unref_ref( im_buffer_t *buffer, IMAGE *im, Rect *area ); -void im_buffer_print( im_buffer_t *buffer ); -void im_invalidate( IMAGE *im ); - /* Macros on REGIONs. * IM_REGION_LSKIP() add to move down line * IM_REGION_N_ELEMENTS() number of elements across region diff --git a/libvips/include/vips/vips.h b/libvips/include/vips/vips.h index 564b6069..7a239f64 100644 --- a/libvips/include/vips/vips.h +++ b/libvips/include/vips/vips.h @@ -101,7 +101,7 @@ extern "C" { #include -/* @(#) Definition for structure to hold integer or double masks +/* Argh, these horrible things must go :( */ typedef struct im__INTMASK {