gimp r25651 - trunk/app/core



Author: neo
Date: Tue May 13 13:46:46 2008
New Revision: 25651
URL: http://svn.gnome.org/viewvc/gimp?rev=25651&view=rev

Log:
cleanup in preparation of adding a SIMD version


Modified:
   trunk/app/core/gimpcurve-map.c

Modified: trunk/app/core/gimpcurve-map.c
==============================================================================
--- trunk/app/core/gimpcurve-map.c	(original)
+++ trunk/app/core/gimpcurve-map.c	Tue May 13 13:46:46 2008
@@ -38,6 +38,12 @@
   CURVE_ALPHA  = 1 << 4
 };
 
+static guint  gimp_curve_get_apply_mask (GimpCurve *curve_colors,
+                                         GimpCurve *curve_red,
+                                         GimpCurve *curve_green,
+                                         GimpCurve *curve_blue,
+                                         GimpCurve *curve_alpha);
+
 
 gdouble
 gimp_curve_map_value (GimpCurve *curve,
@@ -86,21 +92,17 @@
                        gfloat    *dest,
                        glong      samples)
 {
-  guint mask = CURVE_NONE;
-
   g_return_if_fail (GIMP_IS_CURVE (curve_colors));
   g_return_if_fail (GIMP_IS_CURVE (curve_red));
   g_return_if_fail (GIMP_IS_CURVE (curve_green));
   g_return_if_fail (GIMP_IS_CURVE (curve_blue));
   g_return_if_fail (GIMP_IS_CURVE (curve_alpha));
 
-  if (! gimp_curve_is_identity (curve_colors)) mask |= CURVE_COLORS;
-  if (! gimp_curve_is_identity (curve_red))    mask |= CURVE_RED;
-  if (! gimp_curve_is_identity (curve_green))  mask |= CURVE_GREEN;
-  if (! gimp_curve_is_identity (curve_blue))   mask |= CURVE_BLUE;
-  if (! gimp_curve_is_identity (curve_alpha))  mask |= CURVE_ALPHA;
-
-  switch (mask)
+  switch (gimp_curve_get_apply_mask (curve_colors,
+                                     curve_red,
+                                     curve_green,
+                                     curve_blue,
+                                     curve_alpha))
     {
     case CURVE_NONE:
       break;
@@ -184,7 +186,7 @@
         }
       break;
 
-    default: /*  apply all curves                            */
+    default:
       while (samples--)
         {
           dest[0] = gimp_curve_map_value (curve_colors,
@@ -202,5 +204,21 @@
           src  += 4;
           dest += 4;
         }
+      break;
     }
 }
+
+static guint
+gimp_curve_get_apply_mask (GimpCurve *curve_colors,
+                           GimpCurve *curve_red,
+                           GimpCurve *curve_green,
+                           GimpCurve *curve_blue,
+                           GimpCurve *curve_alpha)
+{
+  return ((gimp_curve_is_identity (curve_colors) ? 0 : CURVE_COLORS) |
+          (gimp_curve_is_identity (curve_red)    ? 0 : CURVE_RED)    |
+          (gimp_curve_is_identity (curve_green)  ? 0 : CURVE_GREEN)  |
+          (gimp_curve_is_identity (curve_blue)   ? 0 : CURVE_BLUE)   |
+          (gimp_curve_is_identity (curve_alpha)  ? 0 : CURVE_ALPHA));
+}
+



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