]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sat, 4 Sep 2010 15:05:36 +0000 (15:05 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sat, 4 Sep 2010 15:05:36 +0000 (15:05 +0000)
ChangeLog
coders/pcx.c
magick/quantum.c

index 79391b682ef73e0bd9d05a5243297ca596c25878..ed60d8282abc1bc82e1e066c8efc7df12de105e9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,8 @@
 2010-08-31  6.6.4-0 Cristy  <quetzlzacatenango@image...>
   * Path no longer closed if join style is round (reference
     http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=16943).
+  * Add case for BGRQuantum to GetQuantumExtent().
+  * Support no compression on PCX write.
 
 2010-08-23  6.6.3-10 Cristy  <quetzlzacatenango@image...>
   * Fixed bug in the raw BGRA coders (reference
index fa2942f445f6cda469f33e3dc719bacff3e1c694..8ecc0167aeb4b3b692c29d9e752b76d80235e9d4 100644 (file)
@@ -794,31 +794,39 @@ static MagickBooleanType PCXWritePixels(PCXInfo *pcx_info,
   q=pixels;
   for (i=0; i < (ssize_t) pcx_info->planes; i++)
   {
-    previous=(*q++);
-    count=1;
-    for (x=0; x < (ssize_t) (pcx_info->bytes_per_line-1); x++)
-    {
-      packet=(*q++);
-      if ((packet == previous) && (count < 63))
-        {
-          count++;
-          continue;
-        }
-      if ((count > 1) || ((previous & 0xc0) == 0xc0))
+    if (pcx_info->encoding == 0)
+      {
+        for (x=0; x < (ssize_t) pcx_info->bytes_per_line; x++)
+          (void) WriteBlobByte(image,(unsigned char) (*q++));
+      }
+    else
+      {
+        previous=(*q++);
+        count=1;
+        for (x=0; x < (ssize_t) (pcx_info->bytes_per_line-1); x++)
         {
-          count|=0xc0;
-          (void) WriteBlobByte(image,(unsigned char) count);
+          packet=(*q++);
+          if ((packet == previous) && (count < 63))
+            {
+              count++;
+              continue;
+            }
+          if ((count > 1) || ((previous & 0xc0) == 0xc0))
+            {
+              count|=0xc0;
+              (void) WriteBlobByte(image,(unsigned char) count);
+            }
+          (void) WriteBlobByte(image,previous);
+          previous=packet;
+          count=1;
         }
-      (void) WriteBlobByte(image,previous);
-      previous=packet;
-      count=1;
-    }
-    if ((count > 1) || ((previous & 0xc0) == 0xc0))
-      {
-        count|=0xc0;
-        (void) WriteBlobByte(image,(unsigned char) count);
+        if ((count > 1) || ((previous & 0xc0) == 0xc0))
+          {
+            count|=0xc0;
+            (void) WriteBlobByte(image,(unsigned char) count);
+          }
+        (void) WriteBlobByte(image,previous);
       }
-    (void) WriteBlobByte(image,previous);
   }
   return (MagickTrue);
 }
@@ -899,7 +907,7 @@ static MagickBooleanType WritePCXImage(const ImageInfo *image_info,Image *image)
     */
     pcx_info.identifier=0x0a;
     pcx_info.version=5;
-    pcx_info.encoding=1;
+    pcx_info.encoding=image_info->compression == NoCompression ? 0 : 1;
     pcx_info.bits_per_pixel=8;
     if ((image->storage_class == PseudoClass) &&
         (IsMonochromeImage(image,&image->exception) != MagickFalse))
@@ -976,8 +984,8 @@ static MagickBooleanType WritePCXImage(const ImageInfo *image_info,Image *image)
     for (i=0; i < 58; i++)
       (void) WriteBlobByte(image,'\0');
     length=(size_t) pcx_info.bytes_per_line;
-    pcx_pixels=(unsigned char *) AcquireQuantumMemory(length,
-      pcx_info.planes*sizeof(*pcx_pixels));
+    pcx_pixels=(unsigned char *) AcquireQuantumMemory(length,pcx_info.planes*
+      sizeof(*pcx_pixels));
     if (pcx_pixels == (unsigned char *) NULL)
       ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
     q=pcx_pixels;
@@ -1033,7 +1041,8 @@ static MagickBooleanType WritePCXImage(const ImageInfo *image_info,Image *image)
               {
                 for (x=(ssize_t) pcx_info.bytes_per_line; x != 0; x--)
                 {
-                  *q++=ScaleQuantumToChar((Quantum) (GetAlphaPixelComponent(p)));
+                  *q++=ScaleQuantumToChar((Quantum)
+                    (GetAlphaPixelComponent(p)));
                   p++;
                 }
                 break;
@@ -1121,8 +1130,8 @@ static MagickBooleanType WritePCXImage(const ImageInfo *image_info,Image *image)
                 break;
               if (image->previous == (Image *) NULL)
                 {
-                  status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
-                image->rows);
+                  status=SetImageProgress(image,SaveImageTag,(MagickOffsetType)
+                    y,image->rows);
                   if (status == MagickFalse)
                     break;
                 }
index 9d2e06e801801aed4f2624131161452720f1b7f7..3c43e3e26026a29c2daffef00547be360bebc585 100644 (file)
@@ -308,9 +308,10 @@ MagickExport size_t GetQuantumExtent(const Image *image,
     case GrayAlphaQuantum: packet_size=2; break;
     case IndexAlphaQuantum: packet_size=2; break;
     case RGBQuantum: packet_size=3; break;
+    case BGRQuantum: packet_size=3; break;
     case RGBAQuantum: packet_size=4; break;
-    case BGRAQuantum: packet_size=4; break;
     case RGBOQuantum: packet_size=4; break;
+    case BGRAQuantum: packet_size=4; break;
     case CMYKQuantum: packet_size=4; break;
     case CMYKAQuantum: packet_size=5; break;
     default: break;