From 6c18c0a7c6c338370c7e6beaf02c1e5ea2ce861f Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 11 Oct 2026 11:52:24 +0000 Subject: [PATCH] LR-PREF-PERFORMANCE: preview builds render the larger of view and thumbnail first (a view under 512 px no longer feeds an upscaled thumbnail, follow-up to #927) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BKWB9TCnvzJHV6xMLAj2J4 --- crates/engine/src/cmd/previews.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/engine/src/cmd/previews.rs b/crates/engine/src/cmd/previews.rs index 08dae2644..372a539d1 100644 --- a/crates/engine/src/cmd/previews.rs +++ b/crates/engine/src/cmd/previews.rs @@ -52,17 +52,17 @@ impl PreviewBuild { } } -/// The jobs that build `id`'s previews: the largest grid thumbnail, then the view render at -/// `edge` (`None` = 1:1, the photo's full size). +/// The jobs that build `id`'s previews: the largest grid thumbnail and the view render at `edge` +/// (`None` = 1:1, the photo's full size), the larger first. pub(crate) fn jobs_for(s: &mut Session, id: lightcraft_catalog::PhotoId, edge: Option) -> Vec { let Some(p) = s.catalog.photo(id) else { return Vec::new() }; let full = p.width.max(p.height) as usize; let e = edge.unwrap_or(full).min(full.max(1)).max(1); - let mut v = Vec::new(); - v.extend(s.loupe_job(id, e, e, true)); - // (after the view: it renders from the source the view loaded, see `run_photo`) - v.extend(s.thumb_job(id, THUMB_SIZES[THUMB_SIZES.len() - 1])); - v + let thumb = THUMB_SIZES[THUMB_SIZES.len() - 1]; + let (view, grid) = (s.loupe_job(id, e, e, true), s.thumb_job(id, thumb)); + // the larger render goes first: the one after it renders from the source it loaded (see + // `run_photo`), which must not be smaller than what it needs + if e >= thumb { view.into_iter().chain(grid).collect() } else { grid.into_iter().chain(view).collect() } } /// The build's row in the activity stack (`what` as in [`PreviewBuild::what`]).