From 2f08dcb667a0c577d6c18552e0aa896b2ce4e89b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 2 Feb 2011 21:18:10 +0000 Subject: [PATCH] GRAPHICS: Fixed a bug with indexed PNGs in the PNG decoder (a byte can't hold 256 entries) svn-id: r55742 --- graphics/png.cpp | 2 +- graphics/png.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/graphics/png.cpp b/graphics/png.cpp index d0fe64bf252..5292ea01006 100644 --- a/graphics/png.cpp +++ b/graphics/png.cpp @@ -441,7 +441,7 @@ byte PNG::getNumColorChannels() { } void PNG::readPaletteChunk() { - for (byte i = 0; i < _paletteEntries; i++) { + for (uint16 i = 0; i < _paletteEntries; i++) { _palette[i * 4 + 0] = _stream->readByte(); // R _palette[i * 4 + 1] = _stream->readByte(); // G _palette[i * 4 + 2] = _stream->readByte(); // B diff --git a/graphics/png.h b/graphics/png.h index 6b695b5beb1..b2ba7ac0f2a 100644 --- a/graphics/png.h +++ b/graphics/png.h @@ -145,7 +145,7 @@ private: PNGHeader _header; byte _palette[256 * 4]; // RGBA - byte _paletteEntries; + uint16 _paletteEntries; uint16 _transparentColor[3]; bool _transparentColorSpecified;