]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sat, 28 Jul 2012 00:33:10 +0000 (00:33 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sat, 28 Jul 2012 00:33:10 +0000 (00:33 +0000)
MagickCore/composite.c
MagickCore/pixel-accessor.h
coders/dcm.c
coders/png.c
coders/svg.c

index ec602f432c29b9b1349f465cf0c13ce9b4d4a574..0ad7b83495cf9466cf62ff5941c07e5505072e76 100644 (file)
@@ -533,7 +533,7 @@ static MagickBooleanType CompositeOverImage(Image *image,
 }
 
 MagickExport MagickBooleanType CompositeImage(Image *image,
-  const Image *composite_image,const CompositeOperator compose,
+  const Image *composite,const CompositeOperator compose,
   const MagickBooleanType clip_to_self,const ssize_t x_offset,
   const ssize_t y_offset,ExceptionInfo *exception)
 {
@@ -547,6 +547,7 @@ MagickExport MagickBooleanType CompositeImage(Image *image,
     geometry_info;
 
   Image
+    *composite_image,
     *destination_image;
 
   MagickBooleanType
@@ -574,22 +575,19 @@ MagickExport MagickBooleanType CompositeImage(Image *image,
   assert(image->signature == MagickSignature);
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
-  assert(composite_image != (Image *) NULL);
-  assert(composite_image->signature == MagickSignature);
+  assert(composite!= (Image *) NULL);
+  assert(composite->signature == MagickSignature);
   if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
     return(MagickFalse);
-  if (IsGrayColorspace(image->colorspace) != MagickFalse)
-    {
-      if (IsGrayColorspace(composite_image->colorspace) != MagickFalse)
-        (void) SetImageColorspace(image,RGBColorspace,exception);
-      else
-        (void) TransformImageColorspace(image,composite_image->colorspace,
-          exception);
-    }
+  composite_image=CloneImage(composite,0,0,MagickTrue,exception);
+  if (composite_image == (const Image *) NULL)
+    return(MagickFalse);
+  (void) TransformImageColorspace(composite_image,image->colorspace,exception);
   if ((compose == OverCompositeOp) || (compose == SrcOverCompositeOp))
     {
       status=CompositeOverImage(image,composite_image,clip_to_self,x_offset,
         y_offset,exception);
+      composite_image=DestroyImage(composite_image);
       return(status);
     }
   destination_image=(Image *) NULL;
@@ -2305,6 +2303,7 @@ MagickExport MagickBooleanType CompositeImage(Image *image,
   image_view=DestroyCacheView(image_view);
   if (destination_image != (Image * ) NULL)
     destination_image=DestroyImage(destination_image);
+  composite_image=DestroyImage(composite_image);
   return(status);
 }
 \f
@@ -2363,8 +2362,7 @@ MagickExport MagickBooleanType TextureImage(Image *image,const Image *texture,
   texture_image=CloneImage(texture,0,0,MagickTrue,exception);
   if (texture_image == (const Image *) NULL)
     return(MagickFalse);
-  if (IsGrayColorspace(texture_image->colorspace) != MagickFalse)
-    (void) TransformImageColorspace(texture_image,RGBColorspace,exception);
+  (void) TransformImageColorspace(texture_image,image->colorspace,exception);
   (void) SetImageVirtualPixelMethod(texture_image,TileVirtualPixelMethod,
     exception);
   status=MagickTrue;
index 36610aa595cbe8a954362e9c5e0a8a346961394d..bbc57fcb88baf491b5b775958228362b029303cf 100644 (file)
@@ -74,7 +74,7 @@ static inline Quantum GetPixelBlack(const Image *restrict image,
   const Quantum *restrict pixel)
 {
   if (image->channel_map[BlackPixelChannel].traits == UndefinedPixelTrait)
-    return(0);
+    return((Quantum) 0);
   return(pixel[image->channel_map[BlackPixelChannel].offset]);
 }
 
@@ -109,7 +109,7 @@ static inline Quantum GetPixelChannel(const Image *restrict image,
   const PixelChannel channel,const Quantum *restrict pixel)
 {
   if (image->channel_map[channel].traits == UndefinedPixelTrait)
-    return(0);
+    return((Quantum) 0);
   return(pixel[image->channel_map[channel].offset]);
 }
 
@@ -184,7 +184,7 @@ static inline Quantum GetPixelIndex(const Image *restrict image,
   const Quantum *restrict pixel)
 {
   if (image->channel_map[IndexPixelChannel].traits == UndefinedPixelTrait)
-    return(0);
+    return((Quantum) 0);
   return(pixel[image->channel_map[IndexPixelChannel].offset]);
 }
 
@@ -313,7 +313,7 @@ static inline Quantum GetPixelMask(const Image *restrict image,
   const Quantum *restrict pixel)
 {
   if (image->channel_map[MaskPixelChannel].traits == UndefinedPixelTrait)
-    return(0);
+    return((Quantum) 0);
   return(pixel[image->channel_map[MaskPixelChannel].offset]);
 }
 
index a61c11ac3f48ea85e3cd3f4e1e39d1f2b86c5f73..7d7594ccba837c17e3fa78238f194069636ae4d0 100644 (file)
@@ -40,7 +40,7 @@
   Include declarations.
 */
 #include "MagickCore/studio.h"
-#include "MagickCore/property.h"
+#include "MagickCore/attribute.h"
 #include "MagickCore/blob.h"
 #include "MagickCore/blob-private.h"
 #include "MagickCore/cache.h"
@@ -61,6 +61,7 @@
 #include "MagickCore/monitor-private.h"
 #include "MagickCore/option.h"
 #include "MagickCore/pixel-accessor.h"
+#include "MagickCore/property.h"
 #include "MagickCore/resource_.h"
 #include "MagickCore/quantum-private.h"
 #include "MagickCore/static.h"
@@ -3638,6 +3639,7 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception)
     image->columns=(size_t) width;
     image->rows=(size_t) height;
     image->depth=depth;
+    image->colorspace=RGBColorspace;
     if ((image->colormap == (PixelInfo *) NULL) && (samples_per_pixel == 1))
       {
         size_t
@@ -4053,6 +4055,8 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception)
               }
           }
       }
+    if (IsImageGray(image,exception) != MagickFalse)
+      (void) SetImageColorspace(image,GRAYColorspace,exception);
     if (EOFBlob(image) != MagickFalse)
       {
         ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
index b582236b25fc24d0ea9b35ed833200382c9dbf50..d167161e21050871e965909297ee524531e4201e 100644 (file)
@@ -1808,7 +1808,11 @@ static void MagickPNGWarningHandler(png_struct *ping,png_const_charp message)
 }
 
 #ifdef PNG_USER_MEM_SUPPORTED
-static png_voidp Magick_png_malloc(png_structp png_ptr,png_uint_32 size)
+#if PNG_LIBPNG_VER >= 14000
+static png_voidp Magick_png_malloc(png_structp png_ptr,png_alloc_size_t size)
+#else
+static png_voidp Magick_png_malloc(png_structp png_ptr,png_size_t size)
+#endif
 {
   (void) png_ptr;
   return((png_voidp) AcquireMagickMemory((size_t) size));
@@ -7458,12 +7462,22 @@ Magick_png_write_raw_profile(const ImageInfo *image_info,png_struct *ping,
          (char *) profile_type, (double) length);
      }
 
-   text=(png_textp) png_malloc(ping,(png_uint_32) sizeof(png_text));
+#if PNG_LIBPNG_VER >= 14000
+   text=(png_textp) png_malloc(ping,(png_alloc_size_t) sizeof(png_text));
+#else
+   text=(png_textp) png_malloc(ping,(png_size_t) sizeof(png_text));
+#endif
    description_length=(png_uint_32) strlen((const char *) profile_description);
    allocated_length=(png_uint_32) (length*2 + (length >> 5) + 20
       + description_length);
-   text[0].text=(png_charp) png_malloc(ping,allocated_length);
-   text[0].key=(png_charp) png_malloc(ping, (png_uint_32) 80);
+#if PNG_LIBPNG_VER >= 14000
+   text[0].text=(png_charp) png_malloc(ping,
+      (png_alloc_size_t) allocated_length);
+   text[0].key=(png_charp) png_malloc(ping, (png_alloc_size_t) 80);
+#else
+   text[0].text=(png_charp) png_malloc(ping, (png_size_t) allocated_length);
+   text[0].key=(png_charp) png_malloc(ping, (png_size_t) 80);
+#endif
    text[0].key[0]='\0';
    (void) ConcatenateMagickString(text[0].key,
       "Raw profile type ",MaxTextExtent);
@@ -10782,7 +10796,13 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,
         {
         if (value != (const char *) NULL)
           {
-            text=(png_textp) png_malloc(ping,(png_uint_32) sizeof(png_text));
+
+#if PNG_LIBPNG_VER >= 14000
+            text=(png_textp) png_malloc(ping,
+                 (png_alloc_size_t) sizeof(png_text));
+#else
+            text=(png_textp) png_malloc(ping,(png_size_t) sizeof(png_text));
+#endif
             text[0].key=(char *) property;
             text[0].text=(char *) value;
             text[0].text_length=strlen(value);
index 8f741be64bd56f542c371a9c59eddb602c70be00..cd08349d7504d3047f66d76b90366eb7dd9da38d 100644 (file)
@@ -2938,7 +2938,7 @@ static Image *ReadSVGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                 double
                   gamma;
     
-                gamma=1.0-QuantumScale*fill_color.alpha;
+                gamma=QuantumScale*fill_color.alpha;
                 gamma=MagickEpsilonReciprocal(gamma);
                 fill_color.blue*=gamma;
                 fill_color.green*=gamma;