`cargo fmt --all -- --check` has failed on every run in this repository's history, identically on `main` and on every branch. This is #12. Mechanical: `cargo fmt --all`, nothing else. 154 files, all `.rs`, no other extension touched. `cargo check --workspace` exits 0 afterwards, so nothing changed semantically. ON THE ORDERING, WHICH WAS THE REAL QUESTION. HANDOFF-2026-09-06 section 7 warns this is the expensive fix: a whole-tree reformat before #7 and #8 return "would put a conflict in every file of 861 commits and make the reviews those items exist to enable unreadable". That is measurably too pessimistic, and it had been reasoned rather than tested. Measured here by three-way merging a rustfmt'd `main` against both unmerged branches, file by file: file/branch pairs tested 32 merges CLEAN 28 merges CONFLICTING 4 (8 conflict hunks total) sylpheed-cli/src/main.rs 1 hunk sylpheed-export/src/check.rs 1 sylpheed-export/src/screen.rs 4 sylpheed-export/src/video.rs 2 All four are against `auto/frame-blend-draw-path` only; `auto/port-p6-audio` does not conflict anywhere. The earlier framing -- 154 dirty files, 133 that cannot collide, 21 that can, the collision set carrying 147 of 774 hunks (19%) -- reproduces exactly. What it did not say is that most of the 21 still merge cleanly, because rustfmt's edits and the branches' edits rarely land on the same lines. So the cost of sweeping now is 4 files and 8 hunks for one branch, against a check that is otherwise red forever. Deliberately NOT folded into the WASM PR: 154 reformatted files would make that one unreviewable. Closes #12
68 lines
3.2 KiB
Rust
68 lines
3.2 KiB
Rust
//! Does DRAWING NOTHING beat guessing, for an element with no held pose?
|
|
//!
|
|
//! A keyframe group is entry → hold → exit, and the exit ends invisible (on the
|
|
//! five port screens the final keyframe is invisible for 21/24, 8/16, 12/18, 2/3
|
|
//! and 6/7 elements). So the screen "as seen" is the HOLD — which is why
|
|
//! `rest_plateau` is the primary rule. An element with **no** plateau has no
|
|
//! hold, and `rest()` currently falls back to guessing an endpoint of a movement.
|
|
//!
|
|
//! This renders each screen twice — as-is, and with every plateau-less element
|
|
//! suppressed via `compose`'s `visible` mask — and correlates both against the
|
|
//! live capture. If suppression wins, the fallback should draw nothing.
|
|
//! Writes both composites as raw RGBA (`<out>/entryNN_{asis,suppressed}.raw`,
|
|
//! 1280x720) so the correlation is done outside — this crate has no image
|
|
//! decoder and the comparison is not worth a dependency.
|
|
use sylpheed_formats::{pak, ui_layout};
|
|
|
|
fn main() {
|
|
let pak_path = std::env::args()
|
|
.nth(1)
|
|
.expect("usage: <GP_TITLE.pak> <outdir> <entry>...");
|
|
let ar = pak::PakArchive::open(&pak_path).expect("open");
|
|
let entries: Vec<_> = ar.entries().to_vec();
|
|
let outdir = std::env::args().nth(2).expect("outdir");
|
|
std::fs::create_dir_all(&outdir).ok();
|
|
for spec in std::env::args().skip(3) {
|
|
let idx: usize = spec.parse().unwrap();
|
|
let bytes = ar.read(&entries[idx]).expect("read");
|
|
let Some(build) = ui_layout::parse_build(&bytes) else {
|
|
continue;
|
|
};
|
|
// plateau-less = rest() had to guess: no two adjacent keyframes share a pose
|
|
// Default: suppress plateau-less elements. With SUPPRESS_SUBSTR set,
|
|
// suppress every element whose NAME contains it instead — used to test
|
|
// the entry→hold→exit model's prediction that the splash glows are all
|
|
// finished by the moment the logos are up.
|
|
let by_name = std::env::var("SUPPRESS_SUBSTR").ok();
|
|
let mask: Vec<bool> = build
|
|
.elements
|
|
.iter()
|
|
.map(|e| {
|
|
if let Some(sub) = &by_name {
|
|
return !e.name.to_lowercase().contains(sub.as_str());
|
|
}
|
|
let k = &e.keyframes;
|
|
(0..k.len().saturating_sub(1)).any(|i| {
|
|
k[i].fade == k[i + 1].fade
|
|
&& k[i].scale_x == k[i + 1].scale_x
|
|
&& k[i].scale_y == k[i + 1].scale_y
|
|
&& k[i].x == k[i + 1].x
|
|
&& k[i].y == k[i + 1].y
|
|
})
|
|
})
|
|
.collect();
|
|
let suppressed = mask.iter().filter(|m| !**m).count();
|
|
let opts = ui_layout::ComposeOptions::default();
|
|
let a = ui_layout::compose(&build, &bytes, opts, None);
|
|
let b = ui_layout::compose(&build, &bytes, opts, Some(&mask));
|
|
std::fs::write(format!("{outdir}/entry{idx:02}_asis.raw"), &a.rgba).unwrap();
|
|
std::fs::write(format!("{outdir}/entry{idx:02}_suppressed.raw"), &b.rgba).unwrap();
|
|
println!(
|
|
"entry {idx:2} {}x{} elements {:2} plateau-less suppressed {suppressed}",
|
|
a.width,
|
|
a.height,
|
|
build.elements.len()
|
|
);
|
|
}
|
|
}
|