PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Merge PR #5671: fix(svg): budget rasterised fallback layers across imports
aiongg5676d7c5b00f
diff --cc crates/io/src/svg.rsindex 72b231867,6537aff28..3d66f45e9--- a/crates/io/src/svg.rs+++ b/crates/io/src/svg.rs@@@ -575,9 -608,13 +624,13 @@@ impl Conv// to the origin: undo that shift, apply the parent's transform, then scale to the canvas// and shift so the pixmap starts at (x0, y0).let canvas = tiny_skia::Transform::from_row(k, 0.0, 0.0, k, -(x0 as f32), -(y0 as f32));- let ts = canvas.pre_concat(parent).pre_translate(bb.x(), bb.y());+ let ts = canvas.pre_concat(parent).pre_translate(shift.x(), shift.y());resvg::render_node(node, ts, &mut pixmap.as_mut())?;- Some(Layer::new(name, LayerContent::Raster(surface(&pixmap, Rect::new(x0, y0, x1, y1), self.fmt))))+ let layer = Layer::new(name, LayerContent::Raster(surface(&pixmap, Rect::new(x0, y0, x1, y1), self.fmt)));+ let bytes = pixels * self.fmt.bytes_per_pixel() as u64;+ self.pixel_budget -= bytes;+ self.retained_pixel_bytes += bytes;+ Some(layer)}}