]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Mon, 12 Apr 2010 23:55:03 +0000 (23:55 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Mon, 12 Apr 2010 23:55:03 +0000 (23:55 +0000)
magick/gem.c

index f67f2abc9ada2ed6726173e49e775f516624a71a..a5da9bff85a896427d615bf773341c2a272fb12b 100644 (file)
@@ -189,17 +189,23 @@ MagickExport void ConvertHSBToRGB(const double hue,const double saturation,
 static inline MagickRealType ConvertHueToRGB(MagickRealType m1,
   MagickRealType m2,MagickRealType hue)
 {
+  MagickRealType
+    alpha;
+
   if (hue < 0.0)
     hue+=1.0;
   if (hue > 1.0)
     hue-=1.0;
+  alpha=m1;
   if ((6.0*hue) < 1.0)
-    return(m1+6.0*(m2-m1)*hue);
-  if ((2.0*hue) < 1.0)
-    return(m2);
-  if ((3.0*hue) < 2.0)
-    return(m1+6.0*(m2-m1)*(2.0/3.0-hue));
-  return(m1);
+    alpha=m1+6.0*(m2-m1)*hue;
+  else
+    if ((2.0*hue) < 1.0)
+      alpha=m2;
+    else
+      if ((3.0*hue) < 2.0)
+        alpha=m1+6.0*(m2-m1)*(2.0/3.0-hue);
+  return(alpha < 0.0 ? 0.0 : alpha);
 }
 
 MagickExport void ConvertHSLToRGB(const double hue,const double saturation,