diff --git a/examples/cluster.c b/examples/cluster.c index ca636fb..2b593df 100644 --- a/examples/cluster.c +++ b/examples/cluster.c @@ -158,13 +158,9 @@ static void draw_mfd(cairo_t *cr, cairo_stroke(cr); } -static void draw_gauge_cluster_bg(hexagram_window *window, +static void draw_gauge_cluster_bg(cairo_t *cr, double width, double height) { - cairo_t *cr; - - cr = hexagram_window_create_bg_context(window); - /* * Paint canvas black */ @@ -232,7 +228,7 @@ int main(int argc, char **argv) { width = 1024, height = 480; - cairo_t *fg; + cairo_t *fg, *bg; if ((can_if = hexagram_can_if_open("vcan0")) == NULL) exit(1); @@ -246,16 +242,17 @@ int main(int argc, char **argv) { fd2 = hexagram_window_display_fd(window); /* - * Draw the background layer - */ - draw_gauge_cluster_bg(window, width, height); - - hexagram_window_show(window); - - /* - * Set up the foreground surface + * Set up the rendering surfaces */ fg = hexagram_window_create_fg_context(window); + bg = hexagram_window_create_bg_context(window); + + /* + * Draw the background layer + */ + draw_gauge_cluster_bg(bg, width, height); + + hexagram_window_show(window); /* * Set up file descriptors to monitor