diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-15 15:48:38 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-16 22:47:10 +0300 |
| commit | 8dcb75a5c08b4dd1f225ea531a27824a9f41ae4a (patch) | |
| tree | 48b4b74e857c93ffc03ff1b790b2f9e76e0113ac /src/kitty_graphics.rs | |
| parent | f43a6d4a5591a0286e01de737be7b3f42416898b (diff) | |
refactor: extract active tab surface rendering
Diffstat (limited to 'src/kitty_graphics.rs')
| -rw-r--r-- | src/kitty_graphics.rs | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/kitty_graphics.rs b/src/kitty_graphics.rs index 9cbe4c2f..98577ef8 100644 --- a/src/kitty_graphics.rs +++ b/src/kitty_graphics.rs @@ -153,7 +153,13 @@ pub(crate) fn paint_local_pane_graphics( let cache = LOCAL_HOST_GRAPHICS.get_or_init(|| Mutex::new(HostGraphicsCache::default())); let mut bytes = Vec::new(); if let Ok(mut cache) = cache.lock() { - bytes = encode_local_pane_graphics(app, terminal_runtimes, cell_size, &mut cache); + bytes = encode_local_pane_graphics( + app, + terminal_runtimes, + app.view.tab_surface(), + cell_size, + &mut cache, + ); } if bytes.is_empty() { return Ok(()); @@ -172,6 +178,7 @@ pub(crate) fn paint_local_pane_graphics( pub(crate) fn encode_local_pane_graphics( app: &AppState, terminal_runtimes: &TerminalRuntimeRegistry, + surface: crate::ui::TabSurfaceView<'_>, cell_size: HostCellSize, cache: &mut HostGraphicsCache, ) -> Vec<u8> { @@ -183,7 +190,7 @@ pub(crate) fn encode_local_pane_graphics( cell_width_px = cell_size.width_px, cell_height_px = cell_size.height_px, active = ?app.active, - pane_infos_len = app.view.pane_infos.len(), + pane_infos_len = surface.pane_infos.len(), "paint_local_pane_graphics entry" ); if !mode_ok || !cell_ok { @@ -199,7 +206,8 @@ pub(crate) fn encode_local_pane_graphics( } let view_key = active_view_key(app); - let placements = collect_visible_placements(app, terminal_runtimes, cell_size, &cache.images); + let placements = + collect_visible_placements(app, terminal_runtimes, surface, cell_size, &cache.images); tracing::debug!( placements_collected = placements.len(), "collect_visible_placements result" @@ -228,6 +236,7 @@ pub(crate) fn encode_local_pane_graphics( pub(crate) fn has_visible_pane_graphics( app: &AppState, terminal_runtimes: &TerminalRuntimeRegistry, + surface: crate::ui::TabSurfaceView<'_>, cell_size: HostCellSize, ) -> bool { if app.mode != Mode::Terminal || !cell_size.is_known() { @@ -246,7 +255,7 @@ pub(crate) fn has_visible_pane_graphics( return false; } - for info in &app.view.pane_infos { + for info in surface.pane_infos { let empty_uploaded = HashMap::new(); if app.pane_graphics_layers.get(&info.id).is_some_and(|layer| { let host_placement = @@ -515,6 +524,7 @@ fn active_view_key(app: &AppState) -> Option<HostViewKey> { fn collect_visible_placements( app: &AppState, terminal_runtimes: &TerminalRuntimeRegistry, + surface: crate::ui::TabSurfaceView<'_>, cell_size: HostCellSize, uploaded_images: &HashMap<u32, ImageSignature>, ) -> Vec<HostPlacement> { @@ -538,11 +548,11 @@ fn collect_visible_placements( tracing::debug!( ws_idx, terminal_runtimes_len = terminal_runtimes.len(), - pane_infos_len = app.view.pane_infos.len(), + pane_infos_len = surface.pane_infos.len(), "collect_visible_placements: starting iteration" ); let mut placements = Vec::new(); - for info in &app.view.pane_infos { + for info in surface.pane_infos { if let Some(layer) = app.pane_graphics_layers.get(&info.id) { placements.push(pane_graphics_host_placement( info, |
