about summary refs log tree commit diff stats
path: root/src/img
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-06-12 23:36:09 +0200
committerbptato <nincsnevem662@gmail.com>2023-06-12 23:36:09 +0200
commit3a245434cd4bd75a56700ed7814f78699e3a3dd7 (patch)
tree7ee3f396443ee652857f308a3b2a29f43b2e09ef /src/img
parentd7e9633303952f82b0741391d16b0f958f95d3e5 (diff)
downloadchawan-3a245434cd4bd75a56700ed7814f78699e3a3dd7.tar.gz
Fix various layout bugs, prepare for image support
Diffstat (limited to 'src/img')
-rw-r--r--src/img/png.nim6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/img/png.nim b/src/img/png.nim
index 50b0e980..3de395f2 100644
--- a/src/img/png.nim
+++ b/src/img/png.nim
@@ -138,6 +138,7 @@ func scanlen(reader: PNGReader): int {.inline.} =
   return (w * reader.spp * int(reader.bitDepth) + 7) div 8
 
 proc handleError(reader: var PNGReader, msg: string) =
+  eprint msg
   reader.bmp = nil
   if reader.hasstrm:
     discard inflateEnd(addr reader.strm)
@@ -281,7 +282,6 @@ proc unfilter(reader: var PNGReader, irow: openArray[uint8], bpp: int) =
   of 4u8: # paeth
     reader.err "paeth not implemented yet"
   else:
-    eprint fil
     reader.err "got invalid filter"
 
 proc writepxs(reader: var PNGReader, crow: var openArray[RGBAColor]) =
@@ -414,8 +414,8 @@ proc zlibFree(opaque: pointer, address: pointer) {.cdecl.} =
 
 proc initZStream(reader: var PNGReader) =
   let bps = max(int(reader.bitDepth) div 8, 1)
-  reader.idatBuf = newSeq[uint8](reader.scanlen * reader.height * bps)
-  reader.uprow = newSeq[uint8](reader.width * bps)
+  reader.idatBuf = newSeq[uint8](reader.scanlen * reader.height)
+  reader.uprow = newSeq[uint8](reader.scanlen)
   reader.strm = z_stream(
     zalloc: zlibAlloc,
     zfree: zlibFree