From 153d63d78865ff94e53a7a96829e0a6db9f75ec6 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 4 Apr 2021 21:30:50 +0530 Subject: add day 18 of devlog --- posts/SDL2_devlog.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'posts') diff --git a/posts/SDL2_devlog.md b/posts/SDL2_devlog.md index eb11de8..04ac928 100644 --- a/posts/SDL2_devlog.md +++ b/posts/SDL2_devlog.md @@ -5,6 +5,27 @@ on the editor. The days are listed in reverse chronological order, begin from the bottom, if this is your first time on this page. +### Day 18 + +I added basic support for guides, they can be added and +activated from the `lisp` REPL. Another long standing +improvement I wanted to make was reworking the pixmap +drawing procedure. The old procedure draws a square for each +pixel in the pixmap, coloured according to its value in the +pixmap. Naturally, this means, for an **NxN** pixmap, there +are **N²** calls to SDL! I reworked this procedure to +compress each line of the pixmap using RLE (run length +encoding), and call out to SDL for each run in the line. +This drastically improved drawing speeds on larger grids. +The following is a comparison between the two procedures, +the leftmost picture is the rendered image, the middle +picture is the optimized drawing procedure (draws each run +instead of pixel), and the right most picture is the +primitive drawing procedure (draws each pixel): + +![Day 18](https://u.peppe.rs/U4B.png) + + ### Day 17 I decided to give the text-only statusline a touch up, by @@ -23,7 +44,7 @@ let statusline = let mut primary = Container::uninit() .width(Size::Absolute(16)) .height(Size::Absolute(16)); - + container.place( &mut padding_box, HorAlign::Right, -- cgit v1.2.3