Fix panic in SVG rendering (#11196)
Release Notes: - Fixed a panic in SVG rendering
This commit is contained in:
parent
bc736265be
commit
ad44237467
1 changed files with 4 additions and 3 deletions
|
@ -55,11 +55,12 @@ impl SvgRenderer {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Render the SVG to a pixmap with the specified width and height.
|
// Render the SVG to a pixmap with the specified width and height.
|
||||||
let mut pixmap =
|
let mut pixmap = resvg::tiny_skia::Pixmap::new(size.width.into(), size.height.into())
|
||||||
resvg::tiny_skia::Pixmap::new(size.width.into(), size.height.into()).unwrap();
|
.ok_or(usvg::Error::InvalidSize)?;
|
||||||
|
|
||||||
let transform = tree.view_box().to_transform(
|
let transform = tree.view_box().to_transform(
|
||||||
resvg::tiny_skia::Size::from_wh(size.width.0 as f32, size.height.0 as f32).unwrap(),
|
resvg::tiny_skia::Size::from_wh(size.width.0 as f32, size.height.0 as f32)
|
||||||
|
.ok_or(usvg::Error::InvalidSize)?,
|
||||||
);
|
);
|
||||||
|
|
||||||
resvg::render(&tree, transform, &mut pixmap.as_mut());
|
resvg::render(&tree, transform, &mut pixmap.as_mut());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue