Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

fix(svg): cast channel count for pixel budget arithmetic

Nigel Ihza Firdausy92647dd6ffca
diff --git a/crates/io/src/svg.rs b/crates/io/src/svg.rs
index cc858a069..11d80ed92 100644
--- a/crates/io/src/svg.rs
+++ b/crates/io/src/svg.rs
@@ -331,7 +331,7 @@ impl Conv {
}
fn charge_pixels(&mut self, w: usize, h: usize) -> bool {
- let bytes = (w as u64).saturating_mul(h as u64).saturating_mul(u64::from(self.fmt.channels()) * 4);
+ let bytes = (w as u64).saturating_mul(h as u64).saturating_mul(self.fmt.channels() as u64 * 4);
match self.pixel_budget.checked_sub(bytes) {
Some(remaining) => {
self.pixel_budget = remaining;