about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-07-13 16:59:19 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-07-13 16:59:19 -0700
commit62a2afe0d842534f00decb9e8e4c85cdbcf36bff (patch)
treede90f82f4c2f248f25cb6038a9a757bd4f4a47bb
parent42bb0922fe27968b732cd3d0a875a12591547526 (diff)
downloadmu-62a2afe0d842534f00decb9e8e4c85cdbcf36bff.tar.gz
clean up some unseemly speckles
Turns out they were a bug after all, and scaling the palette was just
making them more obvious. The bug: I was carefully clamping to 0xf0 to
avoid rounding later, but I forgot to do so for values between 0xf0 and
0xff. As a result, some values could round up past 0xff and turn black.
-rw-r--r--img.mu5
1 files changed, 2 insertions, 3 deletions
diff --git a/img.mu b/img.mu
index 14d87545..73aea245 100644
--- a/img.mu
+++ b/img.mu
@@ -26,8 +26,7 @@ fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk)
   var img-storage: image
   var img/esi: (addr image) <- address img-storage
   load-image img, data-disk
-  render-image screen, img, 0/x, 0xd0/y, 0x12c/width=300, 0xc8/height=200
-  render-pgm-image screen, img, 0x140/x, 0/y, 0x12c/width=300, 0xc8/height=200
+  render-image screen, img, 0/x, 0/y, 0x300/width, 0x300/height
 }
 
 fn load-image self: (addr image), data-disk: (addr disk) {
@@ -484,7 +483,7 @@ fn dither-pgm-unordered _src: (addr image), _dest: (addr image) {
         nearest-color <- copy 0
       }
       {
-        compare nearest-color, 0xff
+        compare nearest-color, 0xf0
         break-if-<=
         nearest-color <- copy 0xf0
       }