mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
perf(ui): reuse exact tile bounds for selection and layer edges (#116)
Use the existing weak-identity cache rather than rescanning unchanged boundary pixels. Dense cold scans can cost more; repeated reads reuse exact bounds.
This commit is contained in:
1 parent
66fd3fc0fa
commit
f8f581eea0
2 files changed
+2
-2
No files matched your search
@@ -1024,7 +1024,7 @@ pub fn canvas_view(app: &mut PhotocraftApp, ui: &mut egui::Ui, idx: usize, rect:
|
||||
// View › Show › Layer Edges: the active layer's content bounds.
|
||||
if app.ui.view.shows(app.ui.view.show.layer_edges)
|
||||
&& let Some(st) = app.session.documents().get(idx)
|
||||
&& let Some(b) = st.active_layer.and_then(|id| st.doc.layer(id)).and_then(|l| l.surface()).map(|s| s.content_bounds())
|
||||
&& let Some(b) = st.active_layer.and_then(|id| st.doc.layer(id)).and_then(|l| l.surface()).map(photocraft_compose::bounds::content_bounds)
|
||||
&& !b.is_empty()
|
||||
{
|
||||
painter.rect_stroke(xf.doc_rect(b), 0, Stroke::new(1.0, Color32::from_rgb(0x2d, 0x8c, 0xeb)), egui::StrokeKind::Outside);
|
||||
|
||||
@@ -842,7 +842,7 @@ fn info_panel(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
let fx = move |px: f64| units.format(px, dpi, size.width as f64);
|
||||
let units_y = app.session.prefs().units_and_rulers.clone();
|
||||
let fy = move |px: f64| units_y.format(px, dpi, size.height as f64);
|
||||
let sel = st.doc.selection.as_ref().map(|m| m.content_bounds());
|
||||
let sel = st.doc.selection.as_ref().map(photocraft_compose::bounds::content_bounds);
|
||||
let pos = app
|
||||
.hover_doc
|
||||
.map(|p| (p[0].floor() as i32, p[1].floor() as i32))
|
||||
|
||||
Reference in new issue
Block a user