From 82fdf176c1209ccc170fb2c9528cb7254c24bf83 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 12 Jun 2021 21:02:50 -0700 Subject: snapshot Looks like what's slowing down screen rendering is in fact _font_ rendering. --- shell/sandbox.mu | 53 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 12 deletions(-) (limited to 'shell') diff --git a/shell/sandbox.mu b/shell/sandbox.mu index aa082349..1a72641d 100644 --- a/shell/sandbox.mu +++ b/shell/sandbox.mu @@ -257,25 +257,54 @@ fn render-empty-screen screen: (addr screen), _target-screen: (addr screen), xmi fn render-screen screen: (addr screen), _target-screen: (addr screen), xmin: int, ymin: int -> _/ecx: int { var target-screen/esi: (addr screen) <- copy _target-screen - var to-y/edi: int <- copy ymin # text data - var width/ebx: (addr int) <- get target-screen, width - var height/edx: (addr int) <- get target-screen, height - var from-y/ecx: int <- copy 0 + var width-a/eax: (addr int) <- get target-screen, width + var width/eax: int <- copy *width-a + var xmax: int + copy-to xmax, width + var tmp/eax: int <- copy xmin + add-to xmax, tmp + var height-a/eax: (addr int) <- get target-screen, height + var height/eax: int <- copy *height-a + var ymax: int + copy-to ymax, height + var tmp/eax: int <- copy ymin + add-to ymax, tmp + clear-rect screen, xmin, ymin, xmax, ymax, 0/bg + var data-ah/eax: (addr handle array screen-cell) <- get target-screen, data + var data/eax: (addr array screen-cell) <- lookup *data-ah + var index/ecx: int <- copy 0 + var to-y/edi: int <- copy ymin { - compare from-y, *height + compare to-y, ymax break-if->= - var from-x/edx: int <- copy 0 - var to-x/eax: int <- copy xmin + var to-x/ebx: int <- copy xmin { - compare from-x, *width + compare to-x, xmax break-if->= - print-screen-cell-of-fake-screen screen, target-screen, from-x, from-y, to-x, to-y - from-x <- increment + $render-screen:iter: { + var offset/ecx: (offset screen-cell) <- compute-offset data, index + var src-cell/edx: (addr screen-cell) <- index data, offset + var src-grapheme/eax: (addr grapheme) <- get src-cell, data + var src-fg/ecx: (addr int) <- get src-cell, color + var src-bg/edx: (addr int) <- get src-cell, background-color + { + compare *src-grapheme, 0x20 + break-if-!= + compare *src-bg, 0 + break-if-!= + break $render-screen:iter + } + abort "aa" + draw-grapheme-on-real-screen *src-grapheme, to-x, to-y, *src-fg, *src-bg +#? var foo/eax: int <- count-of-events +#? draw-grapheme-on-real-screen 0x20/space, to-x, to-y, *src-fg, foo +#? count-event + } + index <- increment to-x <- increment loop } - from-y <- increment to-y <- increment loop } @@ -329,7 +358,7 @@ fn render-screen screen: (addr screen), _target-screen: (addr screen), xmin: int loop } } - return to-y + return ymax } fn has-keyboard? _self: (addr sandbox) -> _/eax: boolean { -- cgit 1.4.1-2-gfad0