Format the tree the way the gate asks for it
`cargo fmt --check` is a required step and had drifted across 45 files. Most of it arrived this week: several operations were written in parallel worktrees and merged by hand, and a hand-merge resolves conflicts without ever running the formatter over the result. No behaviour changes — this is `cargo fmt --all` and nothing else, kept as its own commit so the next reader can skip it wholesale rather than search it for one that matters. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -856,7 +856,11 @@ impl MaskLayer {
|
||||
pub fn begin_stroke(&mut self, erase: bool, radius: f32, hardness: f32, flow: f32) -> bool {
|
||||
let full = self.stroke_points() >= MAX_LAYER_POINTS;
|
||||
let MaskSource::Brush { strokes } = &mut self.source else {
|
||||
log::warn!("layer {} is a {} mask, not a brush", self.id, self.source.kind());
|
||||
log::warn!(
|
||||
"layer {} is a {} mask, not a brush",
|
||||
self.id,
|
||||
self.source.kind()
|
||||
);
|
||||
return false;
|
||||
};
|
||||
if full {
|
||||
@@ -1121,7 +1125,10 @@ impl MaskStack {
|
||||
|
||||
/// Generate a fresh layer id that does not collide with an existing one.
|
||||
pub fn next_id(&self) -> String {
|
||||
(1..).map(|n| format!("m{n}")).find(|id| self.get(id).is_none()).expect("infinite range")
|
||||
(1..)
|
||||
.map(|n| format!("m{n}"))
|
||||
.find(|id| self.get(id).is_none())
|
||||
.expect("infinite range")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1178,10 +1185,7 @@ pub(crate) fn compose_layers(stack: &MaskStack) -> LayerShader {
|
||||
// place. A second copy here would be a second thing to keep in step
|
||||
// with `Framing::wgsl_prologue`, and the failure would be a mask that
|
||||
// is subtly wrong only when straightened.
|
||||
let _ = writeln!(
|
||||
out.body,
|
||||
" var m = sample_mask(uv_src, {slot});"
|
||||
);
|
||||
let _ = writeln!(out.body, " var m = sample_mask(uv_src, {slot});");
|
||||
let _ = writeln!(
|
||||
out.body,
|
||||
" m = select(m, 1.0 - m, u.{prefix}_invert > 0.5);"
|
||||
@@ -1403,7 +1407,11 @@ mod tests {
|
||||
assert!(shader.uniform_fields.contains("mask1_exposure_"));
|
||||
assert_eq!(
|
||||
shader.uniform_values.len(),
|
||||
shader.uniform_fields.lines().filter(|l| l.trim_start().starts_with("mask")).count(),
|
||||
shader
|
||||
.uniform_fields
|
||||
.lines()
|
||||
.filter(|l| l.trim_start().starts_with("mask"))
|
||||
.count(),
|
||||
"one value per emitted field"
|
||||
);
|
||||
}
|
||||
@@ -1448,7 +1456,11 @@ mod tests {
|
||||
// A gradient has no region ids, so nothing can go stale about it.
|
||||
let grad = MaskLayer::new(
|
||||
"m2",
|
||||
MaskSource::Linear { centre: (0.5, 0.5), angle: 0.0, width: 0.2 },
|
||||
MaskSource::Linear {
|
||||
centre: (0.5, 0.5),
|
||||
angle: 0.0,
|
||||
width: 0.2,
|
||||
},
|
||||
);
|
||||
assert!(!grad.is_stale(999));
|
||||
}
|
||||
@@ -1458,8 +1470,16 @@ mod tests {
|
||||
let base = segmentation_signature(1600, 1067, 6730, 2);
|
||||
assert_eq!(base, segmentation_signature(1600, 1067, 6730, 2));
|
||||
assert_ne!(base, segmentation_signature(1600, 1067, 6730, 5), "tuning");
|
||||
assert_ne!(base, segmentation_signature(800, 1067, 6730, 2), "proxy size");
|
||||
assert_ne!(base, segmentation_signature(1600, 1067, 42, 2), "region count");
|
||||
assert_ne!(
|
||||
base,
|
||||
segmentation_signature(800, 1067, 6730, 2),
|
||||
"proxy size"
|
||||
);
|
||||
assert_ne!(
|
||||
base,
|
||||
segmentation_signature(1600, 1067, 42, 2),
|
||||
"region count"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user