mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-26 02:37:01 -06:00
M14.4: as_chunks for the pixel loops main gained since the no-panics branch
Same treatment as the branch's `as_chunks` commit (Rust 1.99's `chunks_exact_to_as_chunks` lint) for the flattener's coverage pass, the CMYK ink compositor, the Flattener Preview highlight and four test helpers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
1a5f7f6441
commit
7fb07bb3db
@@ -108,7 +108,14 @@ fn assert_regions_match(s: &Session, before: &Rendered, group: u64, tol: u8, wha
|
||||
|
||||
/// Share of pixels whose colour moved by more than 8/255.
|
||||
fn changed(a: &Rendered, b: &Rendered) -> f64 {
|
||||
let n = a.pixels.chunks_exact(4).zip(b.pixels.chunks_exact(4)).filter(|(p, q)| p.iter().zip(q.iter()).any(|(x, y)| x.abs_diff(*y) > 8)).count();
|
||||
let n = a
|
||||
.pixels
|
||||
.as_chunks::<4>()
|
||||
.0
|
||||
.iter()
|
||||
.zip(b.pixels.as_chunks::<4>().0)
|
||||
.filter(|(p, q)| p.iter().zip(q.iter()).any(|(x, y)| x.abs_diff(*y) > 8))
|
||||
.count();
|
||||
n as f64 / (a.pixels.len() / 4) as f64
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user