]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Wed, 15 Aug 2012 11:36:05 +0000 (11:36 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Wed, 15 Aug 2012 11:36:05 +0000 (11:36 +0000)
MagickCore/image.c
coders/svg.c
coders/wmf.c

index 4a359a871a13b155f2013709df5357ee36aae68b..ec521272990139d2dd855a923d97ac5d40509fe2 100644 (file)
@@ -200,9 +200,6 @@ MagickExport Image *AcquireImage(const ImageInfo *image_info,
     exception);
   (void) QueryColorCompliance(TransparentColor,AllCompliance,
     &image->transparent_color,exception);
-  image->resolution.x=DefaultResolution;
-  image->resolution.y=DefaultResolution;
-  image->units=PixelsPerInchResolution;
   GetTimerInfo(&image->timer);
   image->cache=AcquirePixelCache(0);
   image->channel_mask=DefaultChannels;
index 487d68ec220538194d75954da165de0b92ad45ed..ea2c866c9ff6a141a6da55e9583ef1a84ca35c89 100644 (file)
@@ -184,6 +184,12 @@ typedef struct _SVGInfo
 #endif
 } SVGInfo;
 \f
+/*
+  Static declarations.
+*/
+static char
+  SVGDensityGeometry[] = "90.0x90.0";
+\f
 /*
   Forward declarations.
 */
@@ -2787,6 +2793,20 @@ static Image *ReadSVGImage(const ImageInfo *image_info,ExceptionInfo *exception)
       image=DestroyImageList(image);
       return((Image *) NULL);
     }
+  if ((image->resolution.x == 0.0) || (image->resolution.y == 0.0))
+    {
+      GeometryInfo
+        geometry_info;
+
+      int
+        flags;
+
+      flags=ParseGeometry(SVGDensityGeometry,&geometry_info);
+      image->resolution.x=geometry_info.rho;
+      image->resolution.y=geometry_info.sigma;
+      if ((flags & SigmaValue) == 0)
+        image->resolution.y=image->resolution.x;
+    }
   if (LocaleCompare(image_info->magick,"MSVG") != 0)
     {
       const DelegateInfo
@@ -2891,9 +2911,8 @@ static Image *ReadSVGImage(const ImageInfo *image_info,ExceptionInfo *exception)
         if (svg_handle == (RsvgHandle *) NULL)
           ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
         rsvg_handle_set_base_uri(svg_handle,image_info->filename);
-        if ((image->resolution.x != 72.0) && (image->resolution.y != 72.0))
-          rsvg_handle_set_dpi_x_y(svg_handle,image->resolution.x,
-            image->resolution.y);
+        rsvg_handle_set_dpi_x_y(svg_handle,image->resolution.x,
+          image->resolution.y);
         while ((n=ReadBlob(image,MaxTextExtent,message)) != 0)
         {
           error=(GError *) NULL;
index b0644323de0107303ea1daac50fb4bbc9c3533ec..77ca0bd04970d8b72536274f016c6ea88bc69737 100644 (file)
@@ -2692,14 +2692,14 @@ static Image *ReadWMFImage(const ImageInfo *image_info,ExceptionInfo *exception)
 
   /* User specified resolution */
   resolution_y=DefaultResolution;
-  if (image->resolution.y 0)
+  if (image->resolution.y != 0.0)
     {
       resolution_y = image->resolution.y;
       if (image->units == PixelsPerCentimeterResolution)
         resolution_y *= CENTIMETERS_PER_INCH;
     }
   resolution_x=DefaultResolution;
-  if (image->resolution.x 0)
+  if (image->resolution.x != 0.0)
     {
       resolution_x = image->resolution.x;
       if (image->units == PixelsPerCentimeterResolution)