Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Merge PR #5413: Limit blend-mode hover refreshes to the visible canvas region

David Mann676761c435c3
diff --cc crates/ui-egui/src/canvas.rs
index db11fc730,dee9e1388..9209530c1
--- a/crates/ui-egui/src/canvas.rs
+++ b/crates/ui-egui/src/canvas.rs
@@@ -1648,13 -1618,14 +1654,18 @@@ fn ensure_gpu(app: &mut PhotocraftApp,
// An adjustment preview composited where the view was: catch up where it moved to.
if let Some(r) = crate::adjust_preview::uncovered(app, id, raw_key, visible) {
let r = gpu.refresh(id.0, &doc, Some(r), display.as_deref());
- app.perf.record(r.kind, r.px, r.composite_ms, r.upload_ms);
+ app.perf.record_refresh(&r);
+ }
+ if let Some(r) = crate::adjust_preview::live_uncovered(app, id, raw_key, visible) {
+ let r = gpu.refresh(id.0, &doc, Some(r), display.as_deref());
+ app.perf.record_refresh(&r);
}
- return true;
+ // Blend previews keep offscreen pixels untouched until the view reaches them.
+ // Use the normal refresh path so CPU fallback and pending redraws stay synchronized.
+ damage = crate::blend_preview::uncovered(app, id, revision, raw_key, blend_visible);
+ if damage.is_none() {
+ return true;
+ }
}
// Display textures for a canvas this large would not fit the GPU: the reduced CPU canvas
// draws it (checked before the memory budget, which walks the history, every frame).