Pre-fill the pixmap with the background color to prevent having white strips at the edge

This commit is contained in:
Gergely Polonkai 2022-05-18 17:18:30 +02:00
parent 5e3ab2c7ed
commit c6eee17618
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4

View File

@ -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 dont 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),