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



commit f4088adefa953df77ddd22053e0f0e350591783c
Author: Jacob Boerema <jgboerema gmail com>
Date:   Wed Aug 5 22:39:55 2020 -0400

    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.

 plug-ins/common/file-psp.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
---
diff --git a/plug-ins/common/file-psp.c b/plug-ins/common/file-psp.c
index d46f2ae062..ab84243000 100644
--- a/plug-ins/common/file-psp.c
+++ b/plug-ins/common/file-psp.c
@@ -1339,16 +1339,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
         {
@@ -1358,8 +1349,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++)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]