This branch predates CI on `main`. `cargo fmt --all` only; no behaviour. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
61 lines
2.2 KiB
Rust
61 lines
2.2 KiB
Rust
//! Every scale value on the disc's UI, parents AND nested leaves.
|
|
//!
|
|
//! `DECISIONS.md` records `ptlogo_eff2` at 125 % as "the single drawn element in
|
|
//! the whole export at a scale that is not a whole multiple of 100 %". That
|
|
//! census was over parents only -- leaves were never opened. This opens them.
|
|
use std::collections::BTreeMap;
|
|
use sylpheed_formats::{pak, ui_layout};
|
|
|
|
fn main() {
|
|
let path = std::env::args().nth(1).expect("pak");
|
|
let ar = pak::PakArchive::open(&path).expect("open");
|
|
let mut hist: BTreeMap<(u32, u32), Vec<String>> = BTreeMap::new();
|
|
let mut leaves_opened = 0usize;
|
|
for (i, e) in ar.entries().to_vec().iter().enumerate() {
|
|
let Ok(bytes) = ar.read(e) else { continue };
|
|
let Some(b) = ui_layout::parse_build(&bytes) else {
|
|
continue;
|
|
};
|
|
for el in &b.elements {
|
|
for k in &el.keyframes {
|
|
hist.entry((k.scale_x, k.scale_y))
|
|
.or_default()
|
|
.push(format!("e{i}/{}", el.name));
|
|
}
|
|
if let Some(&(off, size)) = b.records.get(&el.name) {
|
|
if let Some(lb) = ui_layout::parse_build(&bytes[off..off + size]) {
|
|
leaves_opened += 1;
|
|
for le in &lb.elements {
|
|
for k in &le.keyframes {
|
|
hist.entry((k.scale_x, k.scale_y))
|
|
.or_default()
|
|
.push(format!("e{i}/{}->LEAF/{}", el.name, le.name));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
println!("{leaves_opened} leaves opened\n");
|
|
println!("{:>12} {:>7} examples", "scale", "count");
|
|
for (k, v) in &hist {
|
|
let mut ex: Vec<&String> = v.iter().collect();
|
|
ex.sort();
|
|
ex.dedup();
|
|
let odd = k.0 % 100 != 0 || k.1 % 100 != 0;
|
|
println!(
|
|
"{}{:>5},{:<5} {:>7} {}",
|
|
if odd { "* " } else { " " },
|
|
k.0,
|
|
k.1,
|
|
v.len(),
|
|
ex.iter()
|
|
.take(3)
|
|
.map(|s| s.as_str())
|
|
.collect::<Vec<_>>()
|
|
.join(", ")
|
|
);
|
|
}
|
|
println!("\n* = not a whole multiple of 100%");
|
|
}
|