From b3bb1666fa6a0ec674dc5560c6d936f231904795 Mon Sep 17 00:00:00 2001 From: Antonio Carzaniga Date: Fri, 3 Dec 2021 15:58:36 +0100 Subject: [PATCH] (draw_gravity_vector) saving/restoring cairo context, for isolation. --- balls.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/balls.c b/balls.c index 073655e..4a3bb88 100644 --- a/balls.c +++ b/balls.c @@ -214,6 +214,7 @@ int gravity_vector_init = 300; void draw_gravity_vector(cairo_t * cr) { if (gravity_vector_countdown != 0) { + cairo_save(cr); cairo_new_path(cr); cairo_move_to(cr, width/2, height/2); cairo_line_to(cr, width/2 + g_x, height/2 + g_y); @@ -224,6 +225,7 @@ void draw_gravity_vector(cairo_t * cr) { cairo_fill(cr); if (gravity_vector_countdown > 0) --gravity_vector_countdown; + cairo_restore(cr); } }