From 2bee400d4726b62ab2bf18e2db250bc424c47761 Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg Date: Sat, 28 Nov 2020 21:34:24 -0600 Subject: [PATCH] path --- src/pixie/fileformats/png.nim | 3 ++- tests/benchmark_png.nim | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pixie/fileformats/png.nim b/src/pixie/fileformats/png.nim index 4fa73b1..eb43363 100644 --- a/src/pixie/fileformats/png.nim +++ b/src/pixie/fileformats/png.nim @@ -436,6 +436,8 @@ proc encodePng*( else: raise newException(PixieError, "Invalid PNG number of channels") + let data = cast[ptr UncheckedArray[uint8]](data) + # Add the PNG file signature result.add([137.uint8, 80, 78, 71, 13, 10, 26, 10]) @@ -456,7 +458,6 @@ proc encodePng*( for x in 0 ..< width * channels: # Move through the image data byte-by-byte let - data = cast[ptr UncheckedArray[uint8]](data) dataPos = y * width * channels + x filteredPos = y * width * channels + y + 1 + x var left, up: int diff --git a/tests/benchmark_png.nim b/tests/benchmark_png.nim index e03ec3e..4e91c68 100644 --- a/tests/benchmark_png.nim +++ b/tests/benchmark_png.nim @@ -1,7 +1,7 @@ import pixie/fileformats/png, stb_image/read as stbi, stb_image/write as stbr, fidget/opengl/perf, nimPNG -let data = readFile("tests/images/lenna.png") +let data = readFile("tests/images/png/lenna.png") timeIt "pixie decode": for i in 0 ..< 100: