[cairo] Cairo + GTK animation - high Xorg load

Stefan Salewski mail at ssalewski.de
Fri Oct 28 16:16:50 UTC 2016


On Fri, 2016-10-28 at 17:48 +0200, Stefan Salewski wrote:
> Maybe even better:
> https://www.cairographics.org/manual/cairo-cairo-t.html#cairo-push-gr
> oup
> 
> With this you can draw to an intermediate surface with no X involved,
> and copy the result back with the pop operation.

Seems not help much: I have tested with your first example, uncomment
the tree statements below to enable push/pop.

static gboolean drawing_area_draw_cb(GtkWidget *widget, cairo_t *context, void *ptr)
{
	static int redraw_number = 0;
	int width, height, i;
	width = gtk_widget_get_allocated_width(widget);
	height = gtk_widget_get_allocated_height(widget);
  //cairo_push_group (context);
	cairo_set_source_rgb(context, 1, 1, 1);
	cairo_paint(context);
	cairo_set_source_rgb(context, 0.5, 0.5, 0);
	for (i = 1; i < NUM_POINTS; i++)
	{
		cairo_line_to(context,  i, sine_to_point(i + redraw_number, width, height));	
	}	
	cairo_stroke(context);
  //cairo_pop_group_to_source (context);
  //cairo_paint(context);
	redraw_number++;
}

For my box and a large window top shows 99% idle but Xorg task has 30% load with and without push/pop.


More information about the cairo mailing list