]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Fri, 3 Feb 2012 18:25:41 +0000 (18:25 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Fri, 3 Feb 2012 18:25:41 +0000 (18:25 +0000)
MagickCore/colorspace.c

index 63e29f174635d1f6aa06e47b14918fcfa3248903..f069324e8fee1a8f863a30962a9973d4d23314fc 100644 (file)
@@ -879,7 +879,7 @@ MagickExport MagickBooleanType RGBTransformImage(Image *image,
         Nonlinear sRGB to linear RGB (http://www.w3.org/Graphics/Color/sRGB):
 
           R = 1.0*R+0.0*G+0.0*B
-          G = 0.0*R+0.1*G+0.0*B
+          G = 0.0*R+1.0*G+0.0*B
           B = 0.0*R+0.0*G+1.0*B
       */
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
@@ -891,10 +891,10 @@ MagickExport MagickBooleanType RGBTransformImage(Image *image,
           v;
 
         v=(MagickRealType) i/(MagickRealType) MaxMap;
-        if (((MagickRealType) i/(MagickRealType) MaxMap) <= 0.04045f)
-          v/=12.92f;
+        if (((MagickRealType) i/(MagickRealType) MaxMap) <= 0.0031308)
+          v*=12.92f;
         else
-          v=(MagickRealType) pow((((double) i/MaxMap)+0.055)/1.055,2.4);
+          v=(MagickRealType) (1.055*pow((double) i/MaxMap,1.0/2.4)-0.055);
         x_map[i].x=1.0f*MaxMap*v;
         y_map[i].x=0.0f*MaxMap*v;
         z_map[i].x=0.0f*MaxMap*v;
@@ -2312,15 +2312,23 @@ MagickExport MagickBooleanType TransformRGBImage(Image *image,
 #endif
       for (i=0; i <= (ssize_t) MaxMap; i++)
       {
-        x_map[i].x=1.0f*(MagickRealType) i;
-        y_map[i].x=0.0f*(MagickRealType) i;
-        z_map[i].x=0.0f*(MagickRealType) i;
-        x_map[i].y=0.0f*(MagickRealType) i;
-        y_map[i].y=1.0f*(MagickRealType) i;
-        z_map[i].y=0.0f*(MagickRealType) i;
-        x_map[i].z=0.0f*(MagickRealType) i;
-        y_map[i].z=0.0f*(MagickRealType) i;
-        z_map[i].z=1.0f*(MagickRealType) i;
+        MagickRealType
+          v;
+
+        v=(MagickRealType) i/(MagickRealType) MaxMap;
+        if (((MagickRealType) i/(MagickRealType) MaxMap) <= 0.04045f)
+          v/=12.92f;
+        else
+          v=(MagickRealType) pow((((double) i/MaxMap)+0.055)/1.055,2.4);
+        x_map[i].x=1.0f*MaxMap*v;
+        y_map[i].x=0.0f*MaxMap*v;
+        z_map[i].x=0.0f*MaxMap*v;
+        x_map[i].y=0.0f*MaxMap*v;
+        y_map[i].y=1.0f*MaxMap*v;
+        z_map[i].y=0.0f*MaxMap*v;
+        x_map[i].z=0.0f*MaxMap*v;
+        y_map[i].z=0.0f*MaxMap*v;
+        z_map[i].z=1.0f*MaxMap*v;
       }
       break;
     }