]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sun, 28 Apr 2013 23:52:36 +0000 (23:52 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sun, 28 Apr 2013 23:52:36 +0000 (23:52 +0000)
MagickCore/colorspace.c
MagickCore/distort.c
MagickCore/quantize.c
MagickCore/transform.c

index d2c4ad54364c8589cf6559d051c765bc81ac7ee3..44d25206f52d8ff17bbd57c717af90dfaf84f823 100644 (file)
@@ -3165,7 +3165,7 @@ static MagickBooleanType TransformsRGBImage(Image *image,
       for (i=0; i <= (ssize_t) MaxMap; i++)
       {
         x_map[i].x=0.99999999999914679361f*(float) i;
-        y_map[i].x=(1.2188941887145875e-06f)*(float) i;
+        y_map[i].x=(-1.2188941887145875e-06f)*(float) i;
         z_map[i].x=0.5f*1.4019995886561440468f*(2.00f*(float) i-MaxMap);
         x_map[i].y=0.99999975910502514331f*(float) i;
         y_map[i].y=0.5f*(-0.34413567816504303521f)*(2.00f*(float) i-MaxMap);
index d6ce4c458e9d4f95d93649359da022236786f0e1..0ab1c0cef9a1e98ca0f92de36313de406d715a51 100644 (file)
@@ -131,16 +131,6 @@ static void InvertPerspectiveCoefficients(const double *coeff,
   inverse[7]=determinant*(coeff[6]*coeff[1]-coeff[0]*coeff[7]);
 }
 
-static inline double MagickRound(double x)
-{
-  /*
-    Round the fraction to nearest integer.
-  */
-  if (x >= 0.0)
-    return((double) ((ssize_t) (x+0.5)));
-  return((double) ((ssize_t) (x-0.5)));
-}
-
 /*
  * Polynomial Term Defining Functions
  *
@@ -378,6 +368,16 @@ MagickExport Image *AffineTransformImage(const Image *image,
 %  outside other MagickCore library methods.
 */
 
+static inline double MagickRound(double x)
+{
+  /*
+    Round the fraction to nearest integer.
+  */
+  if ((x-floor(x)) < (ceil(x)-x)
+    return(floor(x));
+  return(ceil(x));
+}
+
 static double *GenerateCoefficients(const Image *image,
   DistortImageMethod *method,const size_t number_arguments,
   const double *arguments,size_t number_values,ExceptionInfo *exception)
index 2ba74cec484fe35777dfea08c61eb68824aecd95..dd8b8b1acdbaeff32eec71404be6403f3d4de8db 100644 (file)
@@ -2337,14 +2337,14 @@ MagickExport void GetQuantizeInfo(QuantizeInfo *quantize_info)
 %
 */
 
-static inline ssize_t MagickRound(double x)
+static inline double MagickRound(double x)
 {
   /*
     Round the fraction to nearest integer.
   */
-  if (x >= 0.0)
-    return((ssize_t) (x+0.5));
-  return((ssize_t) (x-0.5));
+  if ((x-floor(x)) < (ceil(x)-x)
+    return(floor(x));
+  return(ceil(x));
 }
 
 MagickExport MagickBooleanType PosterizeImage(Image *image,const size_t levels,
index ba0e8295f0fb03d26044139fc4773c1cd2efaa9c..94de5c44c3ff3356ad9108c64b32fefe3d7356ac 100644 (file)
@@ -766,14 +766,14 @@ MagickExport Image *CropImage(const Image *image,const RectangleInfo *geometry,
 %
 */
 
-static inline ssize_t MagickRound(double x)
+static inline double MagickRound(double x)
 {
   /*
     Round the fraction to nearest integer.
   */
-  if (x >= 0.0)
-    return((ssize_t) (x+0.5));
-  return((ssize_t) (x-0.5));
+  if ((x-floor(x)) < (ceil(x)-x)
+    return(floor(x));
+  return(ceil(x));
 }
 
 MagickExport Image *CropImageToTiles(const Image *image,