From c6eee176186efa30df16fbb580d8fdbf8b67c486 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Wed, 18 May 2022 17:18:30 +0200 Subject: [PATCH] Pre-fill the pixmap with the background color to prevent having white strips at the edge --- src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.rs b/src/main.rs index de69865..bca2020 100644 --- a/src/main.rs +++ b/src/main.rs @@ -543,6 +543,10 @@ fn redraw( let move_x = (buf_x - image_size) as f32 / 2.0; let move_y = (buf_y - image_size) as f32 / 2.0; let mut pixmap = tiny_skia::Pixmap::new(buf_x, buf_y).unwrap(); + // pre-fill the pixmap with our background color so we don’t have a white strip at the edges + pixmap.fill( + tiny_skia::Color::from_rgba(19f32 / 255f32, 17f32 / 255f32, 30f32 / 255f32, 1f32).unwrap(), + ); resvg::render( &svg_tree, usvg::FitTo::Size(image_size, image_size),