diff --git a/common/background-image.c b/common/background-image.c index f3d2551e7..5ede55e33 100644 --- a/common/background-image.c +++ b/common/background-image.c @@ -58,6 +58,7 @@ void render_background_image(cairo_t *cairo, cairo_surface_t *image, double width = cairo_image_surface_get_width(image); double height = cairo_image_surface_get_height(image); + cairo_save(cairo); switch (mode) { case BACKGROUND_MODE_STRETCH: cairo_scale(cairo, @@ -116,4 +117,5 @@ void render_background_image(cairo_t *cairo, cairo_surface_t *image, break; } cairo_paint(cairo); + cairo_restore(cairo); } diff --git a/swaybg/main.c b/swaybg/main.c index 5b0d04587..742669ef3 100644 --- a/swaybg/main.c +++ b/swaybg/main.c @@ -73,6 +73,10 @@ static void render_frame(struct swaybg_state *state) { return; } cairo_t *cairo = state->current_buffer->cairo; + cairo_save(cairo); + cairo_set_operator(cairo, CAIRO_OPERATOR_CLEAR); + cairo_paint(cairo); + cairo_restore(cairo); if (state->args->mode == BACKGROUND_MODE_SOLID_COLOR) { cairo_set_source_u32(cairo, state->context.color); cairo_paint(cairo);