Palm palette read incorrectly

Wolfgang Spraul <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.core
Organization Q AG
Message-ID <[email protected]>
Bob -

(next try)
The Palm palette in palm.c is read incorrectly if QuantumDepth is 8 or 16.
Attached patch fixes this issue. There would have been several ways to clean 
this up. Let me know what you think.

Wolfgang

BTW - palm.c is _very_ _very_ buggy, hopefully we can peel this onion layer by 
layer... (just look at the bits_per_pixel logic in WritePALMImage - urgh - 
for example there is a hang in line 786, should be "bits_per_pixel++" instead 
of "bits_per_pixel*=2". Don't fix it, the bits_per_pixel logic is completely 
broken).
palm-palette.patch (text/x-diff, 1.5 KB)
Index: coders/palm.c
===================================================================
RCS file: /GraphicsMagick/GraphicsMagick/coders/palm.c,v
retrieving revision 1.62
diff -u -r1.62 palm.c
--- coders/palm.c	2003/10/11 18:38:35	1.62
+++ coders/palm.c	2003/11/29 14:07:07
@@ -863,7 +863,7 @@
       }
     else  /* Map colors to Palm standard colormap */
       {
-      map = ConstituteImage(256, 1, "RGB", IntegerPixel,
+      map = ConstituteImage(256, 1, "RGB", QuantumStorageType,
                       &PalmPalette, &exception);
       SetImageType(map, PaletteType);
       MapImage(image, map, False);
Index: magick/image.h
===================================================================
RCS file: /GraphicsMagick/GraphicsMagick/magick/image.h,v
retrieving revision 1.600
diff -u -r1.600 image.h
--- magick/image.h	2003/10/09 08:32:21	1.600
+++ magick/image.h	2003/11/29 14:07:19
@@ -58,6 +58,7 @@
      (unsigned int)117U*(pixel)->blue) \
     >> 10U))
 typedef unsigned char Quantum;
+#define QuantumStorageType CharPixel
 #elif (QuantumDepth == 16)
 #define MaxColormapSize  65536UL
 #define MaxMap 65535UL
@@ -86,6 +87,7 @@
      (unsigned int)117U*(pixel)->blue) \
     >> 10U))
 typedef unsigned short Quantum;
+#define QuantumStorageType ShortPixel
 #elif (QuantumDepth == 32)
 #define MaxColormapSize  65536UL
 #define MaxMap 65535UL
@@ -114,6 +116,7 @@
      (double)117.0*(pixel)->blue) \
     / 1024.0))
 typedef unsigned int Quantum;
+#define QuantumStorageType IntegerPixel
 #else
 # error "Specified value of QuantumDepth is not supported"
 #endif
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.