Phase 3a-1: lazy fault-in of raster keyframe pixels
Raster keyframes are no longer eagerly decoded at load — `raw_pixels` stays empty and is paged in on demand from the project container, so a big paint project opens instantly and only touched frames hit RAM. - core: `read_packed_media_readonly` (fresh read-only connection, can't conflict with an in-place save) + `RasterStore` (holds the container path; `load_pixels` reads+decodes a keyframe's PNG by id). `load_beam_sqlite` stops eager-decoding and instead marks every raster keyframe `needs_fault_in` (recursively, incl. nested); a freshly-created keyframe stays false (blank-resident, nothing to page). Added `Document::all_layers_mut`. - editor: the canvas records a fault-in request when it needs a paged-out keyframe (empty pixels && needs_fault_in); the App drains the sink at the top of update(), pages the pixels in via the store, clears the flag, and repaints. Store path is set on load and after save. Export faults in synchronously per frame. Cold-scrub still shows a 1-frame gap and the page-in is synchronous; the image proxy (3a-2) and async load (3a-3) remove those next.
This commit is contained in:
@@ -650,6 +650,29 @@ impl Document {
|
||||
layers
|
||||
}
|
||||
|
||||
/// Get mutable references to all layers across the entire document
|
||||
/// (root + nested groups + inside all vector clips). Mirrors [`all_layers`].
|
||||
pub fn all_layers_mut(&mut self) -> Vec<&mut AnyLayer> {
|
||||
let mut layers: Vec<&mut AnyLayer> = Vec::new();
|
||||
// Iterative walk with an explicit stack of child slices. Group layers are
|
||||
// descended into but not themselves collected (they hold no keyframes).
|
||||
let mut stack: Vec<&mut [AnyLayer]> = vec![&mut self.root.children];
|
||||
while let Some(list) = stack.pop() {
|
||||
for layer in list {
|
||||
match layer {
|
||||
AnyLayer::Group(g) => {
|
||||
stack.push(&mut g.children);
|
||||
}
|
||||
other => layers.push(other),
|
||||
}
|
||||
}
|
||||
}
|
||||
for clip in self.vector_clips.values_mut() {
|
||||
layers.extend(clip.layers.root_data_mut());
|
||||
}
|
||||
layers
|
||||
}
|
||||
|
||||
// === CLIP LIBRARY METHODS ===
|
||||
|
||||
/// Add a vector clip to the library
|
||||
|
||||
Reference in New Issue
Block a user