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:
+33
-22
@@ -582,10 +582,7 @@ impl MaskPass {
|
||||
MaskSource::Subject { .. } => match subjects.filter(|s| slot < s.len()) {
|
||||
Some(s) => (s, slot),
|
||||
None => {
|
||||
log::warn!(
|
||||
"mask layer {} has no distance field; skipping",
|
||||
layer.id
|
||||
);
|
||||
log::warn!("mask layer {} has no distance field; skipping", layer.id);
|
||||
continue;
|
||||
}
|
||||
},
|
||||
@@ -599,7 +596,14 @@ impl MaskPass {
|
||||
}
|
||||
_ => {
|
||||
let selected = self.selection_buffer(layer, field);
|
||||
self.draw(&mut encoder, slot as u32, ¶ms, field, &selected, subject);
|
||||
self.draw(
|
||||
&mut encoder,
|
||||
slot as u32,
|
||||
¶ms,
|
||||
field,
|
||||
&selected,
|
||||
subject,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -730,14 +734,14 @@ impl MaskPass {
|
||||
// Still worth beginning the pass: the slice has to be cleared, or an
|
||||
// unpainted layer would show whatever the last edit left in it.
|
||||
let bind_group = (!batch.is_empty()).then(|| {
|
||||
let params_buf = self
|
||||
.ctx
|
||||
.device
|
||||
.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||
label: Some("mask-brush-params"),
|
||||
contents: bytemuck::bytes_of(params),
|
||||
usage: wgpu::BufferUsages::UNIFORM,
|
||||
});
|
||||
let params_buf =
|
||||
self.ctx
|
||||
.device
|
||||
.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||
label: Some("mask-brush-params"),
|
||||
contents: bytemuck::bytes_of(params),
|
||||
usage: wgpu::BufferUsages::UNIFORM,
|
||||
});
|
||||
// Rebuilt per rasterisation rather than kept and patched. This runs
|
||||
// when a mask's shape changes, not per frame, and a few kilobytes
|
||||
// of stroke geometry is cheaper to upload than a residency scheme
|
||||
@@ -901,12 +905,9 @@ impl MaskPass {
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 3,
|
||||
resource: wgpu::BindingResource::TextureView(
|
||||
subject
|
||||
.0
|
||||
.view(subject.1)
|
||||
.unwrap_or_else(|| {
|
||||
self.empty_subject.view(0).expect("placeholder exists")
|
||||
}),
|
||||
subject.0.view(subject.1).unwrap_or_else(|| {
|
||||
self.empty_subject.view(0).expect("placeholder exists")
|
||||
}),
|
||||
),
|
||||
},
|
||||
],
|
||||
@@ -949,7 +950,11 @@ impl MaskPass {
|
||||
}
|
||||
|
||||
fn ensure_array(&mut self, width: u32, height: u32, layers: u32) -> Result<(), GpuError> {
|
||||
if self.array.as_ref().is_some_and(|a| a.matches(width, height, layers)) {
|
||||
if self
|
||||
.array
|
||||
.as_ref()
|
||||
.is_some_and(|a| a.matches(width, height, layers))
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
@@ -1111,7 +1116,9 @@ mod tests {
|
||||
}));
|
||||
|
||||
let mut pass = MaskPass::new(&ctx).expect("mask pass");
|
||||
let array = pass.render(&stack, Some(&field), None, w, h).expect("render");
|
||||
let array = pass
|
||||
.render(&stack, Some(&field), None, w, h)
|
||||
.expect("render");
|
||||
assert_eq!(array.size(), (w, h));
|
||||
assert_eq!(array.layers(), 1);
|
||||
}
|
||||
@@ -1201,7 +1208,11 @@ mod tests {
|
||||
assert_eq!(batch.headers.len(), 1);
|
||||
|
||||
let h = &batch.headers[0];
|
||||
assert!(h.hi[0] - h.lo[0] > 0.2, "wide enough for the dab: {h:?}", h = (h.lo, h.hi));
|
||||
assert!(
|
||||
h.hi[0] - h.lo[0] > 0.2,
|
||||
"wide enough for the dab: {h:?}",
|
||||
h = (h.lo, h.hi)
|
||||
);
|
||||
assert!(
|
||||
h.hi[1] - h.lo[1] > h.hi[0] - h.lo[0],
|
||||
"and taller than it is wide in normalised units, since the radius \
|
||||
|
||||
Reference in New Issue
Block a user