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 --- docs/posts/SDL2_devlog/index.html | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'docs/posts/SDL2_devlog/index.html') diff --git a/docs/posts/SDL2_devlog/index.html b/docs/posts/SDL2_devlog/index.html index 6b5fd96..5bfbaf6 100644 --- a/docs/posts/SDL2_devlog/index.html +++ b/docs/posts/SDL2_devlog/index.html @@ -25,15 +25,15 @@ ">View Raw
- 02/04 — 2021 + 04/04 — 2021
- 105.89 + 114.29 cm   - 8.1 + 9.1 min
@@ -43,6 +43,11 @@

I have been working on an editor for the One Bit Image file format in Rust and SDL2. This entry in my blog follows my progress 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 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 +

Day 17

I decided to give the text-only statusline a touch up, by adding a active color and dither level preview. Aligning the “widget” to the right of statusline involved a lot more than I thought, so I created a ghetto CSS-like rectangle placement system to position containers inside containers:

// roughly something like this
@@ -54,7 +59,7 @@
 let mut primary = Container::uninit()
     .width(Size::Absolute(16))
     .height(Size::Absolute(16));
-
+    
 container.place(
     &mut padding_box,
     HorAlign::Right,
-- 
cgit v1.2.3