Commit 2ad03dc6 authored by Jacob Boerema's avatar Jacob Boerema Committed by Jehan

plug-ins: fix incorrect loading of PSP images with uncompressed channel data.

According to the PSP specifications "Each scanline in the image data is stored on a 4 byte boundary.	"
Based on all actual images I've seen this is incorrect. Possibly it is a leftover from an older specification.

(cherry picked from commit f4088ade)
parent af9ccbbe
Pipeline #202723 passed with stages
in 58 minutes and 36 seconds
......@@ -1191,16 +1191,7 @@ read_channel_data (FILE *f,
case PSP_COMP_NONE:
if (bytespp == 1)
{
if ((width % 4) == 0)
fread (pixels[0], height * width, 1, f);
else
{
for (y = 0; y < height; y++)
{
fread (pixels[y], width, 1, f);
fseek (f, 4 - (width % 4), SEEK_CUR);
}
}
fread (pixels[0], height * width, 1, f);
}
else
{
......@@ -1210,8 +1201,8 @@ read_channel_data (FILE *f,
guchar *p, *q;
fread (buf, width, 1, f);
if (width % 4)
fseek (f, 4 - (width % 4), SEEK_CUR);
/* Contrary to what the PSP specification seems to suggest
scanlines are not stored on a 4-byte boundary. */
p = buf;
q = pixels[y] + offset;
for (i = 0; i < width; i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment