Skip to content

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

wasm: gate native-only constants so wasm32 builds without dead-code warnings (#2808) (#2813)

Valentin Klein63fee8c07c9b
diff --git a/crates/cms/src/transform.rs b/crates/cms/src/transform.rs
index 9206b137d..d262956a7 100644
--- a/crates/cms/src/transform.rs
+++ b/crates/cms/src/transform.rs
@@ -510,7 +510,9 @@ fn apply_matrix(m: &Option<(usize, usize, Vec<f32>, Vec<f32>)>, v: &[f32; 16], o
// ------------------------------------------------------------ parallel helpers
+#[cfg(not(target_arch = "wasm32"))]
const PAR_MIN_PIXELS: usize = 16 * 1024;
+#[cfg(not(target_arch = "wasm32"))]
const PAR_CHUNK_PIXELS: usize = 8 * 1024;
#[cfg(not(target_arch = "wasm32"))]
diff --git a/crates/engine/src/file_cmds.rs b/crates/engine/src/file_cmds.rs
index c44373f4c..79d0697e7 100644
--- a/crates/engine/src/file_cmds.rs
+++ b/crates/engine/src/file_cmds.rs
@@ -115,6 +115,7 @@ pub(crate) fn list_images(dir: &str) -> Result<Vec<String>> {
}
/// Extensions the batch commands pick up from a folder.
+#[cfg(not(target_arch = "wasm32"))]
const OPENABLE: &[&str] = &[
"pdn", "ora", "psd", "psb", "pcraft", "png", "jpg", "jpeg", "tif", "tiff", "webp", "gif", "bmp", "tga", "exr", "hdr", "qoi", "ico", "pnm", "ppm", "pgm",
"heic", "heif", "hif", "dng", "cr2", "nef", "nrw", "arw", "pef", "svg", "svgz", "af", "afdesign", "afphoto", "afpub",