All pastes #568138 Raw Edit

workaround: create new surface

public text v1 · immutable
·published 2007-06-15 09:17 UTC
rendered paste body
	cairo_surface_t *surface_copy;
	cairo_surface_t *surface_buffer;
	cairo_t *copy_context;
	
	surface_copy = cairo_surface_create_similar (cairo_get_target (cr),
						CAIRO_CONTENT_ALPHA,
						object->surface_buffer->width,
						object->surface_buffer->height);
	copy_context = cairo_create (surface_copy);
	
	
	/* paint the object surface on the copy FIXME: this it what makes it slow */
	cairo_set_source_surface (copy_context,
		object->surface_buffer->surface,
		0.0f, 0.0f);
	cairo_paint (copy_context);
	cairo_destroy (copy_context);
	
	/* draw shadow to the window context */
	cairo_set_source_surface (cr,
		surface_copy,
		0.0f, 0.0f);
	cairo_paint (cr);
	
	cairo_surface_destroy (surface_copy);