about summary refs log tree commit diff stats
path: root/adapter/img/sixel.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-08-30 15:23:22 +0200
committerbptato <nincsnevem662@gmail.com>2024-08-30 15:23:32 +0200
commit0091042cd67cbacccccb7f474647a3999510ebf8 (patch)
tree7526b7cb93a404810c0d5419126cd4854c5da6de /adapter/img/sixel.nim
parent88cf38acc55923a40610857d1ed9b0b5db33406f (diff)
downloadchawan-0091042cd67cbacccccb7f474647a3999510ebf8.tar.gz
sixel: fix oob
whoops
Diffstat (limited to 'adapter/img/sixel.nim')
-rw-r--r--adapter/img/sixel.nim5
1 files changed, 2 insertions, 3 deletions
diff --git a/adapter/img/sixel.nim b/adapter/img/sixel.nim
index f09166f6..12686288 100644
--- a/adapter/img/sixel.nim
+++ b/adapter/img/sixel.nim
@@ -361,12 +361,11 @@ proc encode(s: string; width, height, offx, offy, cropw: int; halfdump: bool;
       let mask = 1u8 shl i
       var chunk: ptr SixelChunk = nil
       for j in 0 ..< realw:
-        let x = offx + j
-        let m = n + x * 4
+        let m = n + (offx + j) * 4
         let c0 = s.getPixel(m, bgcolor).correctDither(j, dither)
         var diff: DitherDiff
         let c = node.getColor(c0, nodes, diff).idx
-        dither.fs(x, diff)
+        dither.fs(j, diff)
         if chunk == nil or chunk.c != c:
           chunk = addr chunkMap[c - 1]
           chunk.c = c