about summary refs log tree commit diff stats
path: root/html/linux/203stack.subx.html
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-04-20 19:47:57 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-04-20 19:47:57 -0700
commitfb34909b4eb744811f6da2354667179c108870cb (patch)
tree8b5f4c662b9868965645968ef188c5e7ec3b3d10 /html/linux/203stack.subx.html
parentfb3967876c8b97ebf8a7ad5570623a8a4c6dead6 (diff)
downloadmu-fb34909b4eb744811f6da2354667179c108870cb.tar.gz
get bresenham line drawing working with a trace
    (brline . (fn () (screen x0 y0 x1 y1 color)
                 ((fn (dx dy sx sy)
                    ((fn (err)
                       (brline1 screen x0 y0 x1 y1 dx dy sx sy err color))
                     (+ dx dy)))
                  (abs (- x1 x0))
                  (- 0 (abs (- y1 y0)))
                  (sgn (- x1 x0))
                  (sgn (- y1 y0)))))
    (brline1 . (fn () (screen x y xmax ymax dx dy sx sy err color)
                 (pixel screen x y color)
                 (if (andf (= x xmax) (= y ymax))
                   ()
                   ((fn (e2)
                      (brline1 screen
                        (if (>= e2 dy)
                          (+ x sx)
                          x)
                        (if (<= e2 dx)
                          (+ y sy)
                          y)
                        xmax
                        ymax
                        dx
                        dy
                        sx
                        sy
                        (+ err
                           (+
                             (if (>= e2 dy)
                               dy
                               0)
                             (if (<= e2 dx)
                               dx
                               0)))
                        color))
                    (* err 2)))))

sandbox: (brline screen 1 1 5 5 12)

There are two ideas stemming from this commit:
  - I need an extremely compact on-screen trace to underlie the trace UX
  - perhaps we should start truncating trace lines
Diffstat (limited to 'html/linux/203stack.subx.html')
0 files changed, 0 insertions, 0 deletions