]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/gem.c
(no commit message)
[imagemagick] / MagickCore / gem.c
index a4e8df1e206c0c877ab7d4f7b5ed3fb01a59c74f..17a0dd49168c00b960eb39f9f1b58e59351d6076 100644 (file)
@@ -17,7 +17,7 @@
 %                                 August 1996                                 %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization      %
 %  dedicated to making software imaging solutions freely available.           %
 %                                                                             %
 %  You may not use this file except in compliance with the License.  You may  %
@@ -111,40 +111,40 @@ MagickPrivate void ConvertHCLToRGB(const double hue,const double chroma,
   b=0.0;
   if ((0.0 <= h) && (h < 1.0))
     {
-      r=c;      
-      g=x;      
+      r=c;
+      g=x;
     }
   else
     if ((1.0 <= h) && (h < 2.0))
       {
-        r=x;      
-        g=c;      
+        r=x;
+        g=c;
       }
     else
       if ((2.0 <= h) && (h < 3.0))
         {
-          g=c;      
-          b=x;      
+          g=c;
+          b=x;
         }
       else
         if ((3.0 <= h) && (h < 4.0))
           {
-            g=x;      
-            b=c;      
+            g=x;
+            b=c;
           }
         else
           if ((4.0 <= h) && (h < 5.0))
             {
-              r=x;      
-              b=c;      
+              r=x;
+              b=c;
             }
           else
             if ((5.0 <= h) && (h < 6.0))
               {
-                r=c;      
-                b=x;      
+                r=c;
+                b=x;
               }
-  m=luma-0.298839*r+0.586811*g+0.114350*b;
+  m=luma-(0.298839f*r+0.586811f*g+0.114350f*b);
   *red=QuantumRange*(r+m);
   *green=QuantumRange*(g+m);
   *blue=QuantumRange*(b+m);
@@ -474,11 +474,11 @@ MagickPrivate void ConvertRGBToHCL(const double red,const double green,
   max=MagickMax(r,MagickMax(g,b));
   c=max-(double) MagickMin(r,MagickMin(g,b));
   h=0.0;
-  if (c == 0)
+  if (c == 0.0)
     h=0.0;
   else
     if (red == max)
-      h=fmod((g-b)/c,6.0);
+      h=fmod((g-b)/c+6.0,6.0);
     else
       if (green == max)
         h=((b-r)/c)+2.0;
@@ -487,7 +487,7 @@ MagickPrivate void ConvertRGBToHCL(const double red,const double green,
           h=((r-g)/c)+4.0;
   *hue=(h/6.0);
   *chroma=QuantumScale*c;
-  *luma=QuantumScale*(0.298839*r+0.586811*g+0.114350*b);
+  *luma=QuantumScale*(0.298839f*r+0.586811f*g+0.114350f*b);
 }
 \f
 /*
@@ -933,8 +933,8 @@ MagickPrivate size_t GetOptimalKernelWidth1D(const double radius,
   gamma=fabs(sigma);
   if (gamma <= MagickEpsilon)
     return(3UL);
-  alpha=MagickEpsilonReciprocal(2.0*gamma*gamma);
-  beta=(double) MagickEpsilonReciprocal((double) MagickSQ2PI*gamma);
+  alpha=PerceptibleReciprocal(2.0*gamma*gamma);
+  beta=(double) PerceptibleReciprocal((double) MagickSQ2PI*gamma);
   for (width=5; ; )
   {
     normalize=0.0;
@@ -973,8 +973,8 @@ MagickPrivate size_t GetOptimalKernelWidth2D(const double radius,
   gamma=fabs(sigma);
   if (gamma <= MagickEpsilon)
     return(3UL);
-  alpha=MagickEpsilonReciprocal(2.0*gamma*gamma);
-  beta=(double) MagickEpsilonReciprocal((double) Magick2PI*gamma*gamma);
+  alpha=PerceptibleReciprocal(2.0*gamma*gamma);
+  beta=(double) PerceptibleReciprocal((double) Magick2PI*gamma*gamma);
   for (width=5; ; )
   {
     normalize=0.0;