diff --git a/apps/photocraft/src/screen_color.rs b/apps/photocraft/src/screen_color.rs index 8a0d4ca901..ec8cd6378c 100644 --- a/apps/photocraft/src/screen_color.rs +++ b/apps/photocraft/src/screen_color.rs @@ -1,6 +1,11 @@ //! Desktop colour capture starts only on an explicit UI request. No snapshots are written to //! disk, transmitted or retained after a pick. Wayland delegates to its permission portal. -use photocraft_ui_egui::screen_picker::{Capture, MAX_PIXELS, Pending, ScreenImage, Service}; +use photocraft_ui_egui::screen_picker::{Capture, Pending, Service}; +// Only the platform capture backends (and the tests) build images and check sizes. +#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows", test))] +use photocraft_ui_egui::screen_picker::MAX_PIXELS; +#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))] +use photocraft_ui_egui::screen_picker::ScreenImage; pub fn service(cc: &eframe::CreationContext<'_>, wayland: bool) -> Option { if !cfg!(any(target_os = "linux", target_os = "macos", target_os = "windows")) { @@ -34,6 +39,7 @@ pub fn service(cc: &eframe::CreationContext<'_>, wayland: bool) -> Option Option { placements.iter().find(|p| p.x == x && p.y == y && p.width == w && p.height == h).map(|p| p.index) } +#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows", test))] fn count(width: usize, height: usize) -> Result { width.checked_mul(height).filter(|&n| n > 0 && n <= MAX_PIXELS).ok_or_else(|| "Screen capture exceeds the 64 MP memory budget".into()) }