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/index.html | 4 ++-- docs/index.xml | 9 +++++++-- docs/posts/SDL2_devlog/index.html | 13 +++++++++---- docs/posts/index.html | 4 ++-- posts/SDL2_devlog.md | 23 ++++++++++++++++++++++- 5 files changed, 42 insertions(+), 11 deletions(-) diff --git a/docs/index.html b/docs/index.html index ef45474..31f5de2 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,7 +42,7 @@
- 02/04 — 2021 + 04/04 — 2021
SDL2 Devlog @@ -50,7 +50,7 @@ - 8.1 + 9.1 min diff --git a/docs/index.xml b/docs/index.xml index 8d876b6..8a4e57f 100644 --- a/docs/index.xml +++ b/docs/index.xml @@ -14,6 +14,11 @@ SDL2 Devlog <p>I have been working on an editor for the <a href="https://git.peppe.rs/graphics/obi/about">One Bit Image</a> 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.</p> +<h3 id="day-18">Day 18</h3> +<p>I added basic support for guides, they can be added and activated from the <code>lisp</code> 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 <strong>NxN</strong> pixmap, there are <strong>N²</strong> 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):</p> +<figure> +<img src="https://u.peppe.rs/U4B.png" alt="Day 18" /><figcaption aria-hidden="true">Day 18</figcaption> +</figure> <h3 id="day-17">Day 17</h3> <p>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:</p> <div class="sourceCode" id="cb1"><pre class="sourceCode rust"><code class="sourceCode rust"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true"></a><span class="co">// roughly something like this</span></span> @@ -25,7 +30,7 @@ <span id="cb1-7"><a href="#cb1-7" aria-hidden="true"></a><span class="kw">let</span> <span class="kw">mut</span> primary <span class="op">=</span> <span class="pp">Container::</span>uninit()</span> <span id="cb1-8"><a href="#cb1-8" aria-hidden="true"></a> <span class="op">.</span>width(<span class="pp">Size::</span>Absolute(<span class="dv">16</span>))</span> <span id="cb1-9"><a href="#cb1-9" aria-hidden="true"></a> <span class="op">.</span>height(<span class="pp">Size::</span>Absolute(<span class="dv">16</span>))<span class="op">;</span></span> -<span id="cb1-10"><a href="#cb1-10" aria-hidden="true"></a></span> +<span id="cb1-10"><a href="#cb1-10" aria-hidden="true"></a> </span> <span id="cb1-11"><a href="#cb1-11" aria-hidden="true"></a>container<span class="op">.</span>place(</span> <span id="cb1-12"><a href="#cb1-12" aria-hidden="true"></a> <span class="op">&amp;</span><span class="kw">mut</span> padding_box<span class="op">,</span></span> <span id="cb1-13"><a href="#cb1-13" aria-hidden="true"></a> <span class="pp">HorAlign::</span>Right<span class="op">,</span></span> @@ -134,7 +139,7 @@ <img src="https://u.peppe.rs/Ma.png" alt="Day 1" /><figcaption aria-hidden="true">Day 1</figcaption> </figure> https://peppe.rs/posts/SDL2_devlog/ -Fri, 02 Apr 2021 05:01:00 +0000 +Sun, 04 Apr 2021 16:01:00 +0000 https://peppe.rs/posts/SDL2_devlog/ 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,
diff --git a/docs/posts/index.html b/docs/posts/index.html
index 8dcf25c..92e5869 100644
--- a/docs/posts/index.html
+++ b/docs/posts/index.html
@@ -27,7 +27,7 @@
     
         
             
- 02/04 — 2021 + 04/04 — 2021
SDL2 Devlog @@ -35,7 +35,7 @@ - 8.1 + 9.1 min 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