]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Fri, 12 Jun 2015 16:35:04 +0000 (16:35 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Fri, 12 Jun 2015 16:35:04 +0000 (16:35 +0000)
MagickCore/cache-private.h
MagickCore/cache.c
MagickCore/quantum-private.h
MagickCore/stream.c
MagickCore/xwindow.c
MagickWand/composite.c
coders/bmp.c
tests/wandtest.c

index 8b54f440edb2aa6c8b78130f2e7a99adedcdeaa8..54a9b00806d1bde9d8580fa0d3640dada1feddc1 100644 (file)
@@ -98,6 +98,9 @@ typedef struct _CacheMethods
 
   DestroyPixelHandler
     destroy_pixel_handler;
+
+  MagickBooleanType
+    stream;
 } CacheMethods;
 
 typedef struct _NexusInfo
index bd37fae27502d81c696ad10820bb24d12a8abc98..1296b36ceea4651a5d93830f8d4eba6ff62c8a06 100644 (file)
@@ -3350,12 +3350,14 @@ static MagickBooleanType OpenPixelCache(Image *image,const MapMode mode,
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
   if ((image->columns == 0) || (image->rows == 0))
     ThrowBinaryException(CacheError,"NoPixelsDefinedInCache",image->filename);
+  cache_info=(CacheInfo *) image->cache;
+  assert(cache_info->signature == MagickSignature);
+  if (cache_info->methods.stream != MagickFalse)
+    return(MagickTrue);
   if ((AcquireMagickResource(WidthResource,image->columns) == MagickFalse) ||
       (AcquireMagickResource(HeightResource,image->rows) == MagickFalse))
     ThrowBinaryException(ResourceLimitError,"PixelCacheAllocationFailed",
       image->filename);
-  cache_info=(CacheInfo *) image->cache;
-  assert(cache_info->signature == MagickSignature);
   source_info=(*cache_info);
   source_info.file=(-1);
   (void) FormatLocaleString(cache_info->filename,MagickPathExtent,"%s[%.20g]",
@@ -4472,6 +4474,7 @@ MagickPrivate void SetPixelCacheMethods(Cache cache,CacheMethods *cache_methods)
       (GetOneAuthenticPixelFromHandler) NULL)
     cache_info->methods.get_one_authentic_pixel_from_handler=
       cache_methods->get_one_authentic_pixel_from_handler;
+  cache_info->methods.stream=cache_methods->stream;
 }
 \f
 /*
index 292ad7a84fcb9f079ad1583cee224b0ffe8e6156..a1770b39d8d78d970a36652200122aea5096ecef 100644 (file)
@@ -229,22 +229,22 @@ static inline const unsigned char *PushCharPixel(const unsigned char *pixels,
 static inline const unsigned char *PushLongPixel(const EndianType endian,
   const unsigned char *pixels,unsigned int *pixel)
 {
-  register unsigned int
+  register unsigned long
     quantum;
 
   if (endian == LSBEndian)
     {
-      quantum=(unsigned int) (*pixels++);
-      quantum|=(unsigned int) (*pixels++ << 8);
-      quantum|=(unsigned int) (*pixels++ << 16);
-      quantum|=(unsigned int) (*pixels++ << 24);
+      quantum=((unsigned long) *pixels++);
+      quantum|=((unsigned long) *pixels++ << 8);
+      quantum|=((unsigned long) *pixels++ << 16);
+      quantum|=((unsigned long) *pixels++ << 24);
       *pixel=(unsigned int) (quantum & 0xffffffff);
       return(pixels);
     }
-  quantum=(unsigned int) (*pixels++ << 24);
-  quantum|=(unsigned int) (*pixels++ << 16);
-  quantum|=(unsigned int) (*pixels++ << 8);
-  quantum|=(unsigned int) (*pixels++);
+  quantum=((unsigned long) *pixels++ << 24);
+  quantum|=((unsigned long) *pixels++ << 16);
+  quantum|=((unsigned long) *pixels++ << 8);
+  quantum|=((unsigned long) *pixels++);
   *pixel=(unsigned int) (quantum & 0xffffffff);
   return(pixels);
 }
index 4facad81cdd544dded6a87226193e293acac0de1..0fd456542dc970622ddf560100a9f33e39af7d67 100644 (file)
@@ -992,9 +992,9 @@ MagickExport Image *ReadStream(const ImageInfo *image_info,StreamHandler stream,
   read_info->cache=AcquirePixelCache(0);
   GetPixelCacheMethods(&cache_methods);
   cache_methods.get_virtual_pixel_handler=GetVirtualPixelStream;
+  cache_methods.get_virtual_pixels_handler=GetVirtualPixelsStream;
   cache_methods.get_virtual_metacontent_from_handler=
     GetVirtualMetacontentFromStream;
-  cache_methods.get_virtual_pixels_handler=GetVirtualPixelsStream;
   cache_methods.get_authentic_pixels_handler=GetAuthenticPixelsStream;
   cache_methods.queue_authentic_pixels_handler=QueueAuthenticPixelsStream;
   cache_methods.sync_authentic_pixels_handler=SyncAuthenticPixelsStream;
@@ -1005,6 +1005,7 @@ MagickExport Image *ReadStream(const ImageInfo *image_info,StreamHandler stream,
   cache_methods.get_one_authentic_pixel_from_handler=
     GetOneAuthenticPixelFromStream;
   cache_methods.destroy_pixel_handler=DestroyPixelStream;
+  cache_methods.stream=MagickTrue;
   SetPixelCacheMethods(read_info->cache,&cache_methods);
   read_info->stream=stream;
   image=ReadImage(read_info,exception);
index a484483a294b284c83304bc935ac9d5650de08c9..22b2c36539873da9e074959524815e384c3ab9b3 100644 (file)
@@ -1151,7 +1151,7 @@ MagickPrivate XVisualInfo *XBestVisualInfo(Display *display,
 #define XVisualColormapSize(visual_info) MagickMin((unsigned int) (\
   (visual_info->klass == TrueColor) || (visual_info->klass == DirectColor) ? \
    visual_info->red_mask | visual_info->green_mask | visual_info->blue_mask : \
-   (unsigned int) visual_info->colormap_size),1U << visual_info->depth)
+   (unsigned long) visual_info->colormap_size),1UL << visual_info->depth)
 
   char
     *map_type,
index d3af6541fa6c08135aa549fb06e80f30a45bfc01..25bb4aed23cd8ef831eb70cd24edad70272ef6bf 100644 (file)
@@ -381,6 +381,9 @@ static void RelinquishCompositeOptions(CompositeOptions *composite_options)
   if (composite_options->compose_args != (char *) NULL)
     composite_options->compose_args=(char *)
       RelinquishMagickMemory(composite_options->compose_args);
+  if (composite_options->geometry != (char *) NULL)
+    composite_options->geometry=(char *)
+      RelinquishMagickMemory(composite_options->geometry);
 }
 
 WandExport MagickBooleanType CompositeImageCommand(ImageInfo *image_info,
index cd6dc7bec9b5a098911e05c58f0148e8233df044..285918d3254010a51a013fe0729a7438f2b1b14d 100644 (file)
 */
 typedef struct _BMPInfo
 {
-  unsigned int
+  unsigned long
     file_size,
     ba_offset,
     offset_bits,
@@ -125,7 +125,7 @@ typedef struct _BMPInfo
     planes,
     bits_per_pixel;
 
-  unsigned int
+  unsigned long
     compression,
     image_size,
     x_pixels,
@@ -137,7 +137,7 @@ typedef struct _BMPInfo
     alpha_mask,
     colors_important;
 
-  int
+  long
     colorspace;
 
   PrimaryInfo
@@ -594,7 +594,7 @@ static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception)
     bmp_info.offset_bits=ReadBlobLSBLong(image);
     bmp_info.size=ReadBlobLSBLong(image);
     if (image->debug != MagickFalse)
-      (void) LogMagickEvent(CoderEvent,GetMagickModule(),"  BMP size: %u",
+      (void) LogMagickEvent(CoderEvent,GetMagickModule(),"  BMP size: %lu",
         bmp_info.size);
     if (bmp_info.size == 12)
       {
@@ -690,20 +690,19 @@ static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception)
               default:
               {
                 (void) LogMagickEvent(CoderEvent,GetMagickModule(),
-                  "  Compression: UNKNOWN (%u)",bmp_info.compression);
+                  "  Compression: UNKNOWN (%lu)",bmp_info.compression);
               }
             }
             (void) LogMagickEvent(CoderEvent,GetMagickModule(),
-              "  Number of colors: %u",bmp_info.number_colors);
+              "  Number of colors: %lu",bmp_info.number_colors);
           }
         bmp_info.red_mask=ReadBlobLSBLong(image);
         bmp_info.green_mask=ReadBlobLSBLong(image);
         bmp_info.blue_mask=ReadBlobLSBLong(image);
         if (bmp_info.size > 40)
           {
-
             double
-              sum;
+              gamma;
 
             /*
               Read color management information.
@@ -724,24 +723,27 @@ static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception)
             bmp_info.blue_primary.y=(double) ReadBlobLSBLong(image)/BMP_DENOM;
             bmp_info.blue_primary.z=(double) ReadBlobLSBLong(image)/BMP_DENOM;
 
-            sum=bmp_info.red_primary.x+bmp_info.red_primary.y+
+            gamma=bmp_info.red_primary.x+bmp_info.red_primary.y+
               bmp_info.red_primary.z;
-            bmp_info.red_primary.x/=sum;
-            bmp_info.red_primary.y/=sum;
+            gamma=PerceptibleReciprocal(gamma);
+            bmp_info.red_primary.x*=gamma;
+            bmp_info.red_primary.y*=gamma;
             image->chromaticity.red_primary.x=bmp_info.red_primary.x;
             image->chromaticity.red_primary.y=bmp_info.red_primary.y;
 
-            sum=bmp_info.green_primary.x+bmp_info.green_primary.y+
+            gamma=bmp_info.green_primary.x+bmp_info.green_primary.y+
               bmp_info.green_primary.z;
-            bmp_info.green_primary.x/=sum;
-            bmp_info.green_primary.y/=sum;
+            gamma=PerceptibleReciprocal(gamma);
+            bmp_info.green_primary.x*=gamma;
+            bmp_info.green_primary.y*=gamma;
             image->chromaticity.green_primary.x=bmp_info.green_primary.x;
             image->chromaticity.green_primary.y=bmp_info.green_primary.y;
 
-            sum=bmp_info.blue_primary.x+bmp_info.blue_primary.y+
+            gamma=bmp_info.blue_primary.x+bmp_info.blue_primary.y+
               bmp_info.blue_primary.z;
-            bmp_info.blue_primary.x/=sum;
-            bmp_info.blue_primary.y/=sum;
+            gamma=PerceptibleReciprocal(gamma);
+            bmp_info.blue_primary.x*=gamma;
+            bmp_info.blue_primary.y*=gamma;
             image->chromaticity.blue_primary.x=bmp_info.blue_primary.x;
             image->chromaticity.blue_primary.y=bmp_info.blue_primary.y;
 
@@ -1975,7 +1977,7 @@ static MagickBooleanType WriteBMPImage(const ImageInfo *image_info,Image *image,
            default:
            {
              (void) LogMagickEvent(CoderEvent,GetMagickModule(),
-               "   Compression=UNKNOWN (%u)",bmp_info.compression);
+               "   Compression=UNKNOWN (%lu)",bmp_info.compression);
              break;
            }
         }
@@ -1984,7 +1986,7 @@ static MagickBooleanType WriteBMPImage(const ImageInfo *image_info,Image *image,
             "   Number_colors=unspecified");
         else
           (void) LogMagickEvent(CoderEvent,GetMagickModule(),
-            "   Number_colors=%u",bmp_info.number_colors);
+            "   Number_colors=%lu",bmp_info.number_colors);
       }
     (void) WriteBlob(image,2,(unsigned char *) "BM");
     (void) WriteBlobLSBLong(image,bmp_info.file_size);
@@ -2138,7 +2140,7 @@ static MagickBooleanType WriteBMPImage(const ImageInfo *image_info,Image *image,
       }
     if (image->debug != MagickFalse)
       (void) LogMagickEvent(CoderEvent,GetMagickModule(),
-        "  Pixels:  %u bytes",bmp_info.image_size);
+        "  Pixels:  %lu bytes",bmp_info.image_size);
     (void) WriteBlob(image,(size_t) bmp_info.image_size,pixels);
     pixel_info=RelinquishVirtualMemory(pixel_info);
     if (GetNextImageInList(image) == (Image *) NULL)
index c0e5eb5b14c40a73277bf7813b992a5734c2311e..3eef5ce26f7651222811bc63bf060b10576278ab 100644 (file)
@@ -5417,6 +5417,7 @@ int main(int argc,char **argv)
       (void) FormatLocaleFile(stderr,"Option does not match\n");
       exit(1);
     }
+  option=(char *) MagickRelinquishMemory(option);
   options=MagickGetOptions(magick_wand,"*",&number_options);
   if (options != (char **) NULL)
     {
@@ -5444,6 +5445,7 @@ int main(int argc,char **argv)
       (void) FormatLocaleFile(stderr,"Property does not match\n");
       exit(1);
     }
+  property=(char *) MagickRelinquishMemory(property);
   properties=MagickGetImageProperties(magick_wand,"*",&number_properties);
   if (properties != (char **) NULL)
     {