From 4cd7e83a70f1c1b3ccb3dc63ee468cec593a71df Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 3 Feb 2015 13:59:12 +0100 Subject: PNG: fix scaling of grayscale images --- src/PNG.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/PNG.cpp b/src/PNG.cpp index 78df385..6f83fc5 100644 --- a/src/PNG.cpp +++ b/src/PNG.cpp @@ -130,7 +130,7 @@ static void readScaled(uint8_t *data, size_t offset_w, size_t offset_h, const ch for (size_t h = 0; h < width/2; h++) { for (size_t w = 0; w < width/2; w++) { - for (size_t c = 0; c < 4; c++) { + for (size_t c = 0; c < b; c++) { size_t i = 2*b*(width*h + w) + c; data[b*(width*(offset_h+h) + offset_w+w) + c] = (input[i] + input[i+b] + input[i+b*width] + input[i+b*width+b])/4; } -- cgit v1.2.3