From c7f0de14b59ced70e5d26770bfa42745df85b95b Mon Sep 17 00:00:00 2001 From: LepkoQQ Date: Fri, 1 May 2020 13:24:23 +0200 Subject: [PATCH] LibGfx: Decode paletted and grayscale images with 1/2/4 bit depth When dealing with png data that has less than 8 bits per pixel, round up to the next byte when allocating per row buffers and streamers. This fixes decoding odd sized PNGs with less than 8 bits per pixel. Also added a test page with some odd sized palleted PNGs. --- Base/home/anon/www/pngsuite_siz_png.html | 30 ++++++++ Base/home/anon/www/welcome.html | 1 + Libraries/LibGfx/PNGLoader.cpp | 96 ++++++++++++++++-------- 3 files changed, 95 insertions(+), 32 deletions(-) create mode 100644 Base/home/anon/www/pngsuite_siz_png.html diff --git a/Base/home/anon/www/pngsuite_siz_png.html b/Base/home/anon/www/pngsuite_siz_png.html new file mode 100644 index 00000000000..1ed2d072085 --- /dev/null +++ b/Base/home/anon/www/pngsuite_siz_png.html @@ -0,0 +1,30 @@ + + +PngSuite - Odd sizes / PNG-files + + + + + +
--- s01n3p01 - 1x1 paletted file, no interlacing +
--- s02n3p01 - 2x2 paletted file, no interlacing +
--- s03n3p01 - 3x3 paletted file, no interlacing +
--- s04n3p01 - 4x4 paletted file, no interlacing +
--- s05n3p02 - 5x5 paletted file, no interlacing +
--- s06n3p02 - 6x6 paletted file, no interlacing +
--- s07n3p02 - 7x7 paletted file, no interlacing +
--- s08n3p02 - 8x8 paletted file, no interlacing +
--- s09n3p02 - 9x9 paletted file, no interlacing +
--- s32n3p04 - 32x32 paletted file, no interlacing +
--- s33n3p04 - 33x33 paletted file, no interlacing +
--- s34n3p04 - 34x34 paletted file, no interlacing +
--- s35n3p04 - 35x35 paletted file, no interlacing +
--- s36n3p04 - 36x36 paletted file, no interlacing +
--- s37n3p04 - 37x37 paletted file, no interlacing +
--- s38n3p04 - 38x38 paletted file, no interlacing +
--- s39n3p04 - 39x39 paletted file, no interlacing +
--- s40n3p04 - 40x40 paletted file, no interlacing + + + + diff --git a/Base/home/anon/www/welcome.html b/Base/home/anon/www/welcome.html index 66ce6f730c0..77b17473885 100644 --- a/Base/home/anon/www/welcome.html +++ b/Base/home/anon/www/welcome.html @@ -28,6 +28,7 @@ span#ua {

Your user agent is:

Some small test pages: