]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sat, 24 Apr 2010 23:45:19 +0000 (23:45 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sat, 24 Apr 2010 23:45:19 +0000 (23:45 +0000)
coders/jbig.c
coders/pdf.c
coders/png.c
coders/ps.c
coders/ps2.c
coders/ps3.c
magick/image.c

index fad10b6aee1f38601ff1e0f47f180045e5ce93f9..bd3d79edccc2d1ee29991631e25f3248fe9b1658 100644 (file)
@@ -524,8 +524,8 @@ static MagickBooleanType WriteJBIGImage(const ImageInfo *image_info,
           }
         if (image->units == PixelsPerCentimeterResolution)
           {
-            x_resolution*=2.54;
-            y_resolution*=2.54;
+            x_resolution=(unsigned long) (100.0*2.54*x_resolution+0.5)/100.0;
+            y_resolution=(unsigned long) (100.0*2.54*y_resolution+0.5)/100.0;
           }
         (void) jbg_enc_lrlmax(&jbig_info,x_resolution,y_resolution);
       }
index 6fcd1c3583802da892f5af50e6b1225d92113bc8..82e8ce8153adef13f416ddddd01d86e0ab0c8543 100644 (file)
@@ -1253,8 +1253,8 @@ static MagickBooleanType WritePDFImage(const ImageInfo *image_info,Image *image)
       }
     if (image->units == PixelsPerCentimeterResolution)
       {
-        resolution.x*=2.54;
-        resolution.y*=2.54;
+        resolution.x=(unsigned long) (100.0*2.54*resolution.x+0.5)/100.0;
+        resolution.y=(unsigned long) (100.0*2.54*resolution.y+0.5)/100.0;
       }
     SetGeometry(image,&geometry);
     (void) FormatMagickString(page_geometry,MaxTextExtent,"%lux%lu",
index e5b0fdddae00697860fcb310b14821454dd4c0c5..da218bb4c314583c6a1b02d82d32f6066b934b71 100644 (file)
@@ -2044,9 +2044,9 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
         Set image resolution.
       */
       (void) png_get_pHYs(ping,ping_info,&x_resolution,&y_resolution,
-          &unit_type);
-      image->x_resolution=(float) x_resolution;
-      image->y_resolution=(float) y_resolution;
+        &unit_type);
+      image->x_resolution=(double) x_resolution;
+      image->y_resolution=(double) y_resolution;
       if (unit_type == PNG_RESOLUTION_METER)
         {
           image->units=PixelsPerCentimeterResolution;
@@ -2056,8 +2056,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
       if (logging != MagickFalse)
         (void) LogMagickEvent(CoderEvent,GetMagickModule(),
           "    Reading PNG pHYs chunk: xres: %lu, yres: %lu, units: %d.",
-          (unsigned long) x_resolution, (unsigned long) y_resolution,
-          unit_type);
+          (unsigned long) x_resolution,(unsigned long) y_resolution,unit_type);
     }
 #endif
   if (png_get_valid(ping,ping_info,PNG_INFO_PLTE))
@@ -9178,7 +9177,7 @@ static MagickBooleanType WriteMNGImage(const ImageInfo *image_info,Image *image)
            {
              (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                "     TERM delay: %lu",
-               (png_uint_32) (mng_info->ticks_per_second*
+               (unsigned long) (mng_info->ticks_per_second*
                   final_delay/MagickMax(image->ticks_per_second,1)));
              if (image->iterations == 0)
                (void) LogMagickEvent(CoderEvent,GetMagickModule(),
index 47767da6bb5e806954e783a986a23afe5e9039d0..073cba852f4b0dd715edd9f0b15a29a3c41bd31c 100644 (file)
@@ -1422,8 +1422,8 @@ static MagickBooleanType WritePSImage(const ImageInfo *image_info,Image *image)
       }
     if (image->units == PixelsPerCentimeterResolution)
       {
-        resolution.x*=2.54;
-        resolution.y*=2.54;
+        resolution.x=(unsigned long) (100.0*2.54*resolution.x+0.5)/100.0;
+        resolution.y=(unsigned long) (100.0*2.54*resolution.y+0.5)/100.0;
       }
     SetGeometry(image,&geometry);
     (void) FormatMagickString(page_geometry,MaxTextExtent,"%lux%lu",
index 76c78bd6880b3713fae88a313ea504f94af88682..1b152d75469ea8a323a50bbb00b9f009374dafe9 100644 (file)
@@ -511,8 +511,8 @@ static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image)
       }
     if (image->units == PixelsPerCentimeterResolution)
       {
-        resolution.x*=2.54;
-        resolution.y*=2.54;
+        resolution.x=(unsigned long) (100.0*2.54*resolution.x+0.5)/100.0;
+        resolution.y=(unsigned long) (100.0*2.54*resolution.y+0.5)/100.0;
       }
     SetGeometry(image,&geometry);
     (void) FormatMagickString(page_geometry,MaxTextExtent,"%lux%lu",
index 4a2d4784f56c73e6fcadb678317b3f3b6026badf..3207a21a7c90541b04f140faf86d637fbd4df491 100644 (file)
@@ -932,8 +932,8 @@ static MagickBooleanType WritePS3Image(const ImageInfo *image_info,Image *image)
       }
     if (image->units == PixelsPerCentimeterResolution)
       {
-        resolution.x*=2.54;
-        resolution.y*=2.54;
+        resolution.x=(unsigned long) (100.0*2.54*resolution.x+0.5)/100.0;
+        resolution.y=(unsigned long) (100.0*2.54*resolution.y+0.5)/100.0;
       }
     SetGeometry(image,&geometry);
     (void) FormatMagickString(page_geometry,MaxTextExtent,"%lux%lu",
index 9bfcd4802283e8aee9005b96d7aab0a3811f1494..e80932c782612bfa879abb1dbf492bf8fe1a3588 100644 (file)
@@ -4094,8 +4094,10 @@ MagickExport MagickBooleanType SyncImageSettings(const ImageInfo *image_info,
           {
             if (units == PixelsPerInchResolution)
               {
-                image->x_resolution*=2.54;
-                image->y_resolution*=2.54;
+                image->x_resolution=(unsigned long) (100.0*2.54*
+                  image->x_resolution+0.5)/100.0;
+                image->y_resolution=(unsigned long) (100.0*2.54*
+                  image->y_resolution+0.5)/100.0;
               }
             break;
           }