[gimp] app: remove combine_regions_replace()



commit 0215e76acf9ba76c5d68b31a34bcdb408fd37e9a
Author: Michael Natterer <mitch gimp org>
Date:   Sun May 6 19:54:25 2012 +0200

    app: remove combine_regions_replace()

 app/paint-funcs/paint-funcs-generic.h |   84 ---------------------------------
 app/paint-funcs/paint-funcs.c         |   33 -------------
 app/paint-funcs/paint-funcs.h         |    7 ---
 3 files changed, 0 insertions(+), 124 deletions(-)
---
diff --git a/app/paint-funcs/paint-funcs-generic.h b/app/paint-funcs/paint-funcs-generic.h
index 287ff6c..772daa4 100644
--- a/app/paint-funcs/paint-funcs-generic.h
+++ b/app/paint-funcs/paint-funcs-generic.h
@@ -24,90 +24,6 @@
 #define __PAINT_FUNCS_GENERIC_H__
 
 
-static inline void
-replace_pixels (const guchar   *src1,
-                const guchar   *src2,
-                guchar         *dest,
-                const guchar   *mask,
-                gint            length,
-                gint            opacity,
-                const gboolean *affect,
-                gint            bytes1,
-                gint            bytes2)
-{
-  const gint    alpha        = bytes1 - 1;
-  const gdouble norm_opacity = opacity * (1.0 / 65536.0);
-
-  if (bytes1 != bytes2)
-    {
-      g_warning ("replace_pixels only works on commensurate pixel regions");
-      return;
-    }
-
-  while (length --)
-    {
-      guint    b;
-      gdouble  mask_val = mask[0] * norm_opacity;
-
-      /* calculate new alpha first. */
-      gint     s1_a  = src1[alpha];
-      gint     s2_a  = src2[alpha];
-      gdouble  a_val = s1_a + mask_val * (s2_a - s1_a);
-
-      if (a_val == 0)
-        /* In any case, write out versions of the blending function */
-        /* that result when combinations of s1_a, s2_a, and         */
-        /* mask_val --> 0 (or mask_val -->1)                        */
-        {
-          /* Case 1: s1_a, s2_a, AND mask_val all approach 0+:               */
-          /* Case 2: s1_a AND s2_a both approach 0+, regardless of mask_val: */
-
-          if (s1_a + s2_a == 0.0)
-            {
-              for (b = 0; b < alpha; b++)
-                {
-                  gint new_val = 0.5 + (gdouble) src1[b] +
-                    mask_val * ((gdouble) src2[b] - (gdouble) src1[b]);
-
-                  dest[b] = affect[b] ? MIN (new_val, 255) : src1[b];
-                }
-            }
-
-          /* Case 3: mask_val AND s1_a both approach 0+, regardless of s2_a  */
-          else if (s1_a + mask_val == 0.0)
-            {
-              for (b = 0; b < alpha; b++)
-                dest[b] = src1[b];
-            }
-
-          /* Case 4: mask_val -->1 AND s2_a -->0, regardless of s1_a         */
-          else if (1.0 - mask_val + s2_a == 0.0)
-            {
-              for (b = 0; b < alpha; b++)
-                dest[b] = affect[b] ? src2[b] : src1[b];
-            }
-        }
-      else
-        {
-          gdouble a_recip = 1.0 / a_val;
-          /* possible optimization: fold a_recip into s1_a and s2_a           */
-          for (b = 0; b < alpha; b++)
-            {
-              gint new_val = 0.5 + a_recip * (src1[b] * s1_a + mask_val *
-                                              (src2[b] * s2_a - src1[b] * s1_a));
-              dest[b] = affect[b] ? MIN (new_val, 255) : src1[b];
-            }
-        }
-
-      dest[alpha] = affect[alpha] ? a_val + 0.5: s1_a;
-      src1 += bytes1;
-      src2 += bytes2;
-      dest += bytes2;
-      mask++;
-    }
-}
-
-
 inline void
 copy_gray_to_inten_a_pixels (const guchar *src,
                              guchar       *dest,
diff --git a/app/paint-funcs/paint-funcs.c b/app/paint-funcs/paint-funcs.c
index 6ed9e80..761b0ab 100644
--- a/app/paint-funcs/paint-funcs.c
+++ b/app/paint-funcs/paint-funcs.c
@@ -2591,36 +2591,3 @@ combine_regions (PixelRegion          *src1,
   pixel_regions_process_parallel ((PixelProcessorFunc) combine_sub_region,
                                   &st, 4, src1, src2, dest, mask);
 }
-
-void
-combine_regions_replace (PixelRegion     *src1,
-                         PixelRegion     *src2,
-                         PixelRegion     *dest,
-                         PixelRegion     *mask,
-                         guint            opacity,
-                         const gboolean  *affect)
-{
-  gpointer pr;
-
-  for (pr = pixel_regions_register (4, src1, src2, dest, mask);
-       pr != NULL;
-       pr = pixel_regions_process (pr))
-    {
-      const guchar  *s1 = src1->data;
-      const guchar  *s2 = src2->data;
-      guchar        *d  = dest->data;
-      const guchar  *m  = mask->data;
-      guint          h;
-
-      for (h = 0; h < src1->h; h++)
-        {
-          replace_pixels (s1, s2, d, m, src1->w,
-                          opacity, affect, src1->bytes, src2->bytes);
-
-          s1 += src1->rowstride;
-          s2 += src2->rowstride;
-          d += dest->rowstride;
-          m += mask->rowstride;
-        }
-    }
-}
diff --git a/app/paint-funcs/paint-funcs.h b/app/paint-funcs/paint-funcs.h
index d3f5764..64ac594 100644
--- a/app/paint-funcs/paint-funcs.h
+++ b/app/paint-funcs/paint-funcs.h
@@ -250,12 +250,5 @@ void  combine_regions                     (PixelRegion    *src1,
                                            const gboolean *affect,
                                            CombinationMode type);
 
-void  combine_regions_replace             (PixelRegion    *src1,
-                                           PixelRegion    *src2,
-                                           PixelRegion    *dest,
-                                           PixelRegion    *mask,
-                                           guint           opacity,
-                                           const gboolean *affect);
-
 
 #endif  /*  __PAINT_FUNCS_H__  */



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