Phase 3b: bound resident raster pixels with an eviction LRU

Scrubbing a large paint project no longer accumulates every visited frame in RAM.
A fault-in-recency LRU keeps the most-recently-paged-in RASTER_RESIDENT_MAX (12)
keyframes resident and drops the pixels of older *clean* ones (re-arming their
fault-in so they re-page on revisit). The shown frame is always the most-recent
fault-in, so it's never evicted.

Data-loss safety: a new `dirty` flag marks any keyframe whose `raw_pixels` were
mutated by editing (stroke/fill/paint-bucket/floating-lift + their undo/redo) and
is NOT yet in the container. Dirty keyframes are NEVER evicted — they're only
unpinned from the LRU. The flag is cleared on a successful save, which also re-arms
the LRU for the now-clean resident frames so the bound still applies to frames
edited this session.

Also: the save loop now walks all layers (incl. nested) to match the load path's
recursive fault-in arming — evicted frames keep their existing container row
(media_exists), and nested raster keyframes are persisted + covered by live_media.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Skyler Lehmkuhl
2026-06-19 17:56:37 -04:00
co-authored by Claude Opus 4.8
parent 2e07a88905
commit 39dc402ba3
6 changed files with 90 additions and 1 deletions
@@ -5821,6 +5821,9 @@ impl StagePane {
kf.raw_pixels[si..si + 4].fill(0);
}
}
// Punching the hole edits raw_pixels but is NOT committed through an
// action yet — mark dirty so eviction can't drop the un-persisted hole.
kf.dirty = true;
}
// Re-set selection (commit_raster_floating_now cleared it) and create float.