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



commit 2ad03dc61cd295a1486b72d8bc65cc2f2420b6ca
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.
    
    (cherry picked from commit f4088adefa953df77ddd22053e0f0e350591783c)

 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 17cd6e0df1..a2997a41c1 100644
--- a/plug-ins/common/file-psp.c
+++ b/plug-ins/common/file-psp.c
@@ -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++)


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