diff options
author | bptato <nincsnevem662@gmail.com> | 2024-08-30 15:23:22 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-08-30 15:23:32 +0200 |
commit | 0091042cd67cbacccccb7f474647a3999510ebf8 (patch) | |
tree | 7526b7cb93a404810c0d5419126cd4854c5da6de /adapter/img/sixel.nim | |
parent | 88cf38acc55923a40610857d1ed9b0b5db33406f (diff) | |
download | chawan-0091042cd67cbacccccb7f474647a3999510ebf8.tar.gz |
sixel: fix oob
whoops
Diffstat (limited to 'adapter/img/sixel.nim')
-rw-r--r-- | adapter/img/sixel.nim | 5 |
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 |