From 05b2cc0e1e9b4ffb160f0edee947d793213bedc5 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 3 Feb 2015 13:59:57 +0100 Subject: PNG: fix mipmapping 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 6f83fc5..9edf88c 100644 --- a/src/PNG.cpp +++ b/src/PNG.cpp @@ -139,7 +139,7 @@ static void readScaled(uint8_t *data, size_t offset_w, size_t offset_h, const ch } void mipmap(const char *output, size_t width, size_t height, bool colored, const char *nw, const char *ne, const char *sw, const char *se) { - uint8_t data[4*width*height]; + uint8_t data[(colored ? 4 : 2)*width*height]; std::memset(data, 0, sizeof(data)); readScaled(data, 0, 0, nw, width, height, colored); -- cgit v1.2.3