updated cargo fmt

This commit is contained in:
Henry Schimke
2023-10-28 11:04:14 -05:00
parent 4c9ec95d00
commit 5ea03cc066
24 changed files with 122 additions and 64 deletions

View File

@@ -52,10 +52,15 @@ impl SVGLuminanceSource {
pub fn new(svg_data: &[u8]) -> Result<Self> {
// Load the SVG file
let Ok(tree) = resvg::usvg::Tree::from_data(svg_data, &Options::default()) else {
return Err(Exceptions::format_with(format!("could not parse svg data: {}", "err")));
return Err(Exceptions::format_with(format!(
"could not parse svg data: {}",
"err"
)));
};
let Some(mut pixmap) = resvg::tiny_skia::Pixmap::new(tree.size.width() as u32, tree.size.height() as u32) else {
let Some(mut pixmap) =
resvg::tiny_skia::Pixmap::new(tree.size.width() as u32, tree.size.height() as u32)
else {
return Err(Exceptions::format_with("could not create pixmap"));
};
@@ -63,9 +68,13 @@ impl SVGLuminanceSource {
tree_resvg.render(resvg::tiny_skia::Transform::default(), &mut pixmap.as_mut());
let Some(buffer) = RgbaImage::from_raw(tree.size.width() as u32, tree.size.height() as u32, pixmap.data().to_vec()) else {
return Err(Exceptions::format_with("could not create image buffer"));
};
let Some(buffer) = RgbaImage::from_raw(
tree.size.width() as u32,
tree.size.height() as u32,
pixmap.data().to_vec(),
) else {
return Err(Exceptions::format_with("could not create image buffer"));
};
// let Ok(image) = image::load_from_memory_with_format(pixmap.data(), image::ImageFormat::Bmp) else {
// return Err(Exceptions::format("could not generate image"));