summaryrefslogtreecommitdiffstats
path: root/rsnix/src/vt.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rsnix/src/vt.rs')
-rw-r--r--rsnix/src/vt.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/rsnix/src/vt.rs b/rsnix/src/vt.rs
index 9444063..c5fc5fd 100644
--- a/rsnix/src/vt.rs
+++ b/rsnix/src/vt.rs
@@ -147,6 +147,31 @@ pub fn size() -> (usize, usize) {
147 unsafe { (ROWS, COLS) } 147 unsafe { (ROWS, COLS) }
148} 148}
149 149
150/// Re-render the console's cells into the shadow for a pixel region, so the
151/// window manager can restore the console (layer 0) beneath a window that
152/// moved, closed, or was minimized. Does not push — the caller pushes once.
153pub fn repaint_region(x: usize, y: usize, w: usize, h: usize) {
154 unsafe {
155 if CELLS.is_null() {
156 return;
157 }
158 let (cols, rows) = (COLS, ROWS);
159 let c0 = x / 8;
160 let c1 = (x + w).div_ceil(8).min(cols);
161 let r0 = y / 16;
162 let r1 = (y + h).div_ceil(16).min(rows);
163 let cells = &*CELLS;
164 for r in r0..r1 {
165 for c in c0..c1 {
166 let cell = cells[r * cols + c];
167 let fg = PALETTE[cell.fg as usize];
168 let bg = PALETTE[cell.bg as usize];
169 crate::gop::shadow_glyph_px(c * 8, r * 16, cell.ch, fg, bg);
170 }
171 }
172 }
173}
174
150/// DEBUG (crash-family): read one cell's raw word (ch | fg<<16 | bg<<24) 175/// DEBUG (crash-family): read one cell's raw word (ch | fg<<16 | bg<<24)
151/// from the live cells grid and the rendered grid, for the given text 176/// from the live cells grid and the rendered grid, for the given text
152/// row/col. Returns (raw_cell, raw_rendered). 177/// row/col. Returns (raw_cell, raw_rendered).