PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Merge remote-tracking branch 'origin/main' into HEAD
David Manna738fcb9fe1a
diff --cc crates/engine/src/image_cmds.rsindex ae977f717,6d5342b93..282e7c711--- a/crates/engine/src/image_cmds.rs+++ b/crates/engine/src/image_cmds.rs@@@ -666,9 -668,24 +681,24 @@@ fn rotated_crop(s: &mut Session, r: Recrotated: true,};crate::analysis_cmds::compound(s, "Crop", |s| {+ // Pixels the crop deletes needn't be turned first: keeping only what lands in the frame+ // makes the rotation cost the frame's size, not the canvas's (a small turned crop of a+ // 10 MP photo took over half a second).+ if delete {+ let keep = turned_crop_source(size, new, angle, target);+ s.edit("Crop", |doc, _| {+ for_each_surface(&mut doc.layers, true, &mut |surf, _| *surf = crop_surface(surf, keep));+ for ch in doc.channels.iter_mut().chain(doc.quick_mask.as_mut()) {+ ch.surface = crop_surface(&ch.surface, keep);+ }+ // The crop drops the selection anyway.+ doc.selection = None;+ Ok(())+ })?;+ }crate::mode_cmds::rotate_arbitrary(s, &json!({"angle": angle, "direction": "ccw"}))?;// Color Sampler points follow the crop's origin shift too (the rotation moved them above).- s.set_sampler_map(photocraft_geom::Affine::translate(-f64::from(target.x0), -f64::from(target.y0)));+ s.set_sampler_map(crop_target.sampler_map(target));let extension = s.tools.background;s.edit("Crop", |doc, active| {crop_doc(doc, CMD, target, delete, extension)?;