[gimp] app: remove gimp_gegl_replace()



commit d2f84131734f97747762660bd05f0fbe4c5d2bb4
Author: Ell <ell_se yahoo com>
Date:   Thu Feb 14 08:09:16 2019 -0500

    app: remove gimp_gegl_replace()
    
    Remove gimp_gegl_replace(), which is not used anywhere since the
    last commit.  It's redundant with the rest of our compositing code,
    in particular, gimp:replace and gimp:mask-components.

 app/gegl/gimp-gegl-loops.cc | 127 --------------------------------------------
 app/gegl/gimp-gegl-loops.h  |  11 ----
 2 files changed, 138 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-loops.cc b/app/gegl/gimp-gegl-loops.cc
index 1c00206f86..c8c1a07c66 100644
--- a/app/gegl/gimp-gegl-loops.cc
+++ b/app/gegl/gimp-gegl-loops.cc
@@ -814,133 +814,6 @@ gimp_gegl_combine_mask_weird (GeglBuffer          *mask_buffer,
     });
 }
 
-void
-gimp_gegl_replace (GeglBuffer          *top_buffer,
-                   const GeglRectangle *top_rect,
-                   GeglBuffer          *bottom_buffer,
-                   const GeglRectangle *bottom_rect,
-                   GeglBuffer          *mask_buffer,
-                   const GeglRectangle *mask_rect,
-                   GeglBuffer          *dest_buffer,
-                   const GeglRectangle *dest_rect,
-                   gdouble              opacity,
-                   const gboolean      *affect)
-{
-  if (! top_rect)
-    top_rect = gegl_buffer_get_extent (top_buffer);
-
-  if (! bottom_rect)
-    bottom_rect = gegl_buffer_get_extent (bottom_buffer);
-
-  if (! mask_rect)
-    mask_rect = gegl_buffer_get_extent (mask_buffer);
-
-  if (! dest_rect)
-    dest_rect = gegl_buffer_get_extent (dest_buffer);
-
-  gegl_parallel_distribute_area (
-    top_rect, PIXELS_PER_THREAD,
-    [=] (const GeglRectangle *top_area)
-    {
-      GeglBufferIterator *iter;
-
-      SHIFTED_AREA (bottom, top);
-      SHIFTED_AREA (mask, top);
-      SHIFTED_AREA (dest, top);
-
-      iter = gegl_buffer_iterator_new (top_buffer, top_area, 0,
-                                       babl_format ("RGBA float"),
-                                       GEGL_ACCESS_READ, GEGL_ABYSS_NONE, 4);
-
-      gegl_buffer_iterator_add (iter, bottom_buffer, bottom_area, 0,
-                                babl_format ("RGBA float"),
-                                GEGL_ACCESS_READ, GEGL_ABYSS_NONE);
-
-      gegl_buffer_iterator_add (iter, mask_buffer, mask_area, 0,
-                                babl_format ("Y float"),
-                                GEGL_ACCESS_READ, GEGL_ABYSS_NONE);
-
-      gegl_buffer_iterator_add (iter, dest_buffer, dest_area, 0,
-                                babl_format ("RGBA float"),
-                                GEGL_ACCESS_WRITE, GEGL_ABYSS_NONE);
-
-      while (gegl_buffer_iterator_next (iter))
-        {
-          const gfloat *top    = (const gfloat *) iter->items[0].data;
-          const gfloat *bottom = (const gfloat *) iter->items[1].data;
-          const gfloat *mask   = (const gfloat *) iter->items[2].data;
-          gfloat       *dest   = (gfloat *)       iter->items[3].data;
-          gint          count  = iter->length;
-
-          while (count--)
-            {
-              gint    b;
-              gdouble mask_val = *mask * opacity;
-
-              /* calculate new alpha first. */
-              gfloat   s1_a  = bottom[3];
-              gfloat   s2_a  = top[3];
-              gdouble  a_val = s1_a + mask_val * (s2_a - s1_a);
-
-              if (a_val == 0.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)
-                   */
-
-                  /* 1: s1_a, s2_a, AND mask_val all approach 0+: */
-                  /* 2: s1_a AND s2_a both approach 0+, regardless of mask_val: */
-                  if (s1_a + s2_a == 0.0)
-                    {
-                      for (b = 0; b < 3; b++)
-                        {
-                          gfloat new_val;
-
-                          new_val = bottom[b] + mask_val * (top[b] - bottom[b]);
-
-                          dest[b] = affect[b] ? new_val : bottom[b];
-                        }
-                    }
-
-                  /* 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 < 3; b++)
-                        dest[b] = bottom[b];
-                    }
-
-                  /* 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 < 3; b++)
-                        dest[b] = affect[b] ? top[b] : bottom[b];
-                    }
-                }
-              else
-                {
-                  gdouble a_recip = 1.0 / a_val;
-
-                  /* possible optimization: fold a_recip into s1_a and s2_a */
-                  for (b = 0; b < 3; b++)
-                    {
-                      gfloat new_val = a_recip * (bottom[b] * s1_a + mask_val *
-                                                  (top[b] * s2_a - bottom[b] * s1_a));
-                      dest[b] = affect[b] ? new_val : bottom[b];
-                    }
-                }
-
-              dest[3] = affect[3] ? a_val : s1_a;
-
-              top    += 4;
-              bottom += 4;
-              mask   += 1;
-              dest   += 4;
-            }
-        }
-    });
-}
-
 void
 gimp_gegl_index_to_mask (GeglBuffer          *indexed_buffer,
                          const GeglRectangle *indexed_rect,
diff --git a/app/gegl/gimp-gegl-loops.h b/app/gegl/gimp-gegl-loops.h
index bf7fae8035..872c2b4660 100644
--- a/app/gegl/gimp-gegl-loops.h
+++ b/app/gegl/gimp-gegl-loops.h
@@ -81,17 +81,6 @@ void   gimp_gegl_combine_mask_weird    (GeglBuffer               *mask_buffer,
                                         gdouble                   opacity,
                                         gboolean                  stipple);
 
-void   gimp_gegl_replace               (GeglBuffer               *top_buffer,
-                                        const GeglRectangle      *top_rect,
-                                        GeglBuffer               *bottom_buffer,
-                                        const GeglRectangle      *bottom_rect,
-                                        GeglBuffer               *mask_buffer,
-                                        const GeglRectangle      *mask_rect,
-                                        GeglBuffer               *dest_buffer,
-                                        const GeglRectangle      *dest_rect,
-                                        gdouble                   opacity,
-                                        const gboolean           *affect);
-
 void   gimp_gegl_index_to_mask         (GeglBuffer               *indexed_buffer,
                                         const GeglRectangle      *indexed_rect,
                                         const Babl               *indexed_format,


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