[gimp/goat-invasion: 458/608] app: get rid of cpercep in siox



commit f9871b1e4e1551fdc5da168e4705dc88a2b698dc
Author: Ãyvind KolÃs <pippin gimp org>
Date:   Sun Apr 8 03:12:44 2012 +0200

    app: get rid of cpercep in siox

 app/base/siox.c |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)
---
diff --git a/app/base/siox.c b/app/base/siox.c
index a9ecd7a..8822e47 100644
--- a/app/base/siox.c
+++ b/app/base/siox.c
@@ -44,7 +44,7 @@
 
 #include "paint-funcs/paint-funcs.h"
 
-#include "cpercep.h"
+#include <babl/babl.h>
 #include "pixel-region.h"
 #include "tile.h"
 #include "tile-manager.h"
@@ -135,41 +135,45 @@ calc_lab (const guchar *src,
           const guchar *colormap,
           lab          *pixel)
 {
-  gdouble l, a, b;
+  float rgb[3];
+  float lab[3];
 
   switch (bpp)
     {
     case 3:  /* RGB  */
     case 4:  /* RGBA */
-      cpercep_rgb_to_space (src[RED],
-                            src[GREEN],
-                            src[BLUE], &l, &a, &b);
+      rgb[0] = src[RED];
+      rgb[1] = src[GREEN];
+      rgb[2] = src[BLUE];
       break;
-
     case 2:
     case 1:
       if (colormap) /* INDEXED(A) */
         {
           gint i = *src * 3;
 
-          cpercep_rgb_to_space (colormap[i + RED],
-                                colormap[i + GREEN],
-                                colormap[i + BLUE], &l, &a, &b);
+          rgb[0] = colormap[i + RED];
+          rgb[1] = colormap[i + GREEN];
+          rgb[2] = colormap[i + BLUE];
         }
       else /* GRAY(A) */
         {
-          /*  FIXME: there should be cpercep_gray_to_space  */
-          cpercep_rgb_to_space (*src, *src, *src, &l, &a, &b);
+          rgb[0] = *src;
+          rgb[1] = *src;
+          rgb[2] = *src;
         }
       break;
 
     default:
       g_return_if_reached ();
     }
+  babl_process (babl_fish (babl_format ("R'G'B' float"),
+                           babl_format ("CIE Lab float")),
+                rgb, lab, 1);
 
-  pixel->l = l;
-  pixel->a = a;
-  pixel->b = b;
+  pixel->l = lab[0];
+  pixel->a = lab[1];
+  pixel->b = lab[2];
 }
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]