Example #1
0
/* Return the first item.
 */
static VipsOperation *
vips_cache_get_first( void )
{
	if( vips_cache_table )
		return( VIPS_OPERATION( vips_hash_table_map( vips_cache_table, 
			vips_cache_get_first_fn, NULL, NULL ) ) );
	else
		return( NULL ); 
}
Example #2
0
/* Return the first item.
 */
static VipsOperation *
vips_cache_get_first( void )
{
	VipsOperationCacheEntry *entry;

	if( vips_cache_table &&
		(entry = vips_hash_table_map( vips_cache_table, 
			vips_cache_get_first_fn, NULL, NULL )) )
		return( VIPS_OPERATION( entry->operation ) );

	return( NULL ); 
}
Example #3
0
static void
vips_operation_finalize( GObject *gobject )
{
	VipsOperation *operation = VIPS_OPERATION( gobject );

	VIPS_DEBUG_MSG( "vips_operation_finalize: %p\n", gobject );

	if( operation->pixels ) {
		VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( gobject );

		vips_info( class->nickname, 
			_( "%d pixels calculated" ), operation->pixels ); 
	}
Example #4
0
static int
vips_foreign_load_svg_generate( VipsRegion *or, 
	void *seq, void *a, void *b, gboolean *stop )
{
	VipsForeignLoadSvg *svg = (VipsForeignLoadSvg *) a;
	VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( svg );
	VipsRect *r = &or->valid;

	cairo_surface_t *surface;
	cairo_t *cr;
	int y;

	/* rsvg won't always paint the background.
	 */
	vips_region_black( or ); 

	surface = cairo_image_surface_create_for_data( 
		VIPS_REGION_ADDR( or, r->left, r->top ), 
		CAIRO_FORMAT_ARGB32, 
		r->width, r->height, 
		VIPS_REGION_LSKIP( or ) );
	cr = cairo_create( surface );
	cairo_surface_destroy( surface );

	cairo_scale( cr, svg->cairo_scale, svg->cairo_scale );
	cairo_translate( cr, -r->left / svg->cairo_scale,
		-r->top / svg->cairo_scale );

	/* rsvg is single-threaded, but we don't need to lock since we're
	 * running inside a non-threaded tilecache.
	 */
	if( !rsvg_handle_render_cairo( svg->page, cr ) ) {
		vips_operation_invalidate( VIPS_OPERATION( svg ) );
		vips_error( class->nickname, 
			"%s", _( "SVG rendering failed" ) );
		return( -1 );
	}