[gimp] app: remove gaussian_blur_region() and its helpers



commit ef3cfb48cc81fab66968de05bcbe6d7510de7b5d
Author: Michael Natterer <mitch gimp org>
Date:   Thu Mar 15 21:14:36 2012 +0100

    app: remove gaussian_blur_region() and its helpers

 app/paint-funcs/paint-funcs.c |  209 -----------------------------------------
 app/paint-funcs/paint-funcs.h |    4 -
 2 files changed, 0 insertions(+), 213 deletions(-)
---
diff --git a/app/paint-funcs/paint-funcs.c b/app/paint-funcs/paint-funcs.c
index 996977c..e46778f 100644
--- a/app/paint-funcs/paint-funcs.c
+++ b/app/paint-funcs/paint-funcs.c
@@ -95,8 +95,6 @@ static const guchar  no_mask = OPAQUE_OPACITY;
 
 /*  Local function prototypes  */
 
-static gint *   make_curve               (gdouble         sigma_square,
-                                          gint           *length);
 static gdouble  cubic                    (gdouble         dx,
                                           gint            jm1,
                                           gint            j,
@@ -117,42 +115,6 @@ static void     apply_layer_mode_replace (const guchar   *src1,
 static inline void rotate_pointers       (guchar        **p,
                                           guint32         n);
 
-/*
- * The equations: g(r) = exp (- r^2 / (2 * sigma^2))
- *                   r = sqrt (x^2 + y^2)
- */
-
-static gint *
-make_curve (gdouble  sigma_square,
-            gint    *length)
-{
-  const gdouble sigma2 = 2 * sigma_square;
-  const gdouble l      = sqrt (-sigma2 * LOG_1_255);
-
-  gint *curve;
-  gint  i, n;
-
-  n = ceil (l) * 2;
-  if ((n % 2) == 0)
-    n += 1;
-
-  curve = g_new (gint, n);
-
-  *length = n / 2;
-  curve += *length;
-  curve[0] = 255;
-
-  for (i = 1; i <= *length; i++)
-    {
-      gint temp = (gint) (exp (- SQR (i) / sigma2) * 255);
-
-      curve[-i] = temp;
-      curve[i] = temp;
-    }
-
-  return curve;
-}
-
 
 static inline void
 run_length_encode (const guchar *src,
@@ -2312,177 +2274,6 @@ separate_alpha_region (PixelRegion *srcR)
     }
 }
 
-void
-gaussian_blur_region (PixelRegion *srcR,
-                      gdouble      radius_x,
-                      gdouble      radius_y)
-{
-  glong   width, height;
-  guint   bytes;
-  guchar *src, *sp;
-  guchar *dest, *dp;
-  guchar *data;
-  guint  *buf, *b;
-  gint    pixels;
-  gint    total;
-  gint    i, row, col;
-  gint    start, end;
-  gint   *curve;
-  gint   *sum;
-  gint    val;
-  gint    length;
-  gint    alpha;
-  gint    initial_p;
-  gint    initial_m;
-
-  if (radius_x == 0.0 && radius_y == 0.0)
-    return;
-
-  /*  allocate the result buffer  */
-  length = MAX (srcR->w, srcR->h) * srcR->bytes;
-  data = g_new (guchar, length * 2);
-  src = data;
-  dest = data + length;
-
-  width = srcR->w;
-  height = srcR->h;
-  bytes = srcR->bytes;
-  alpha = bytes - 1;
-
-  buf = g_new (guint, MAX (width, height) * 2);
-
-  if (radius_y != 0.0)
-    {
-      curve = make_curve (- SQR (radius_y) / (2 * LOG_1_255), &length);
-
-      sum = g_new (gint, 2 * length + 1);
-      sum[0] = 0;
-
-      for (i = 1; i <= length * 2; i++)
-        sum[i] = curve[i - length - 1] + sum[i - 1];
-
-      sum += length;
-
-      total = sum[length] - sum[-length];
-
-      for (col = 0; col < width; col++)
-        {
-          pixel_region_get_col (srcR, col + srcR->x, srcR->y, height, src, 1);
-          sp = src + alpha;
-
-          initial_p = sp[0];
-          initial_m = sp[(height - 1) * bytes];
-
-          /*  Determine a run-length encoded version of the column  */
-          run_length_encode (sp, buf, height, bytes);
-
-          for (row = 0; row < height; row++)
-            {
-              start = (row < length) ? -row : -length;
-              end = (height <= (row + length)) ? (height - row - 1) : length;
-
-              val = total / 2;
-              i = start;
-              b = buf + (row + i) * 2;
-
-              if (start != -length)
-                val += initial_p * (sum[start] - sum[-length]);
-
-              while (i < end)
-                {
-                  pixels = b[0];
-                  i += pixels;
-                  if (i > end)
-                    i = end;
-                  val += b[1] * (sum[i] - sum[start]);
-                  b += (pixels * 2);
-                  start = i;
-                }
-
-              if (end != length)
-                val += initial_m * (sum[length] - sum[end]);
-
-              sp[row * bytes] = val / total;
-            }
-
-          pixel_region_set_col (srcR, col + srcR->x, srcR->y, height, src);
-        }
-
-      g_free (sum - length);
-      g_free (curve - length);
-    }
-
-  if (radius_x != 0.0)
-    {
-      curve = make_curve (- SQR (radius_x) / (2 * LOG_1_255), &length);
-
-      sum = g_new (gint, 2 * length + 1);
-      sum[0] = 0;
-
-      for (i = 1; i <= length * 2; i++)
-        sum[i] = curve[i - length - 1] + sum[i - 1];
-
-      sum += length;
-
-      total = sum[length] - sum[-length];
-
-      for (row = 0; row < height; row++)
-        {
-          pixel_region_get_row (srcR, srcR->x, row + srcR->y, width, src, 1);
-          sp = src + alpha;
-          dp = dest + alpha;
-
-          initial_p = sp[0];
-          initial_m = sp[(width - 1) * bytes];
-
-          /*  Determine a run-length encoded version of the row  */
-          run_length_encode (sp, buf, width, bytes);
-
-          for (col = 0; col < width; col++)
-            {
-              start = (col < length) ? -col : -length;
-              end = (width <= (col + length)) ? (width - col - 1) : length;
-
-              val = total / 2;
-              i = start;
-              b = buf + (col + i) * 2;
-
-              if (start != -length)
-                val += initial_p * (sum[start] - sum[-length]);
-
-              while (i < end)
-                {
-                  pixels = b[0];
-
-                  i += pixels;
-
-                  if (i > end)
-                    i = end;
-
-                  val += b[1] * (sum[i] - sum[start]);
-                  b += (pixels * 2);
-                  start = i;
-                }
-
-              if (end != length)
-                val += initial_m * (sum[length] - sum[end]);
-
-              val = val / total;
-
-              dp[col * bytes] = val;
-            }
-
-          pixel_region_set_row (srcR, srcR->x, row + srcR->y, width, dest);
-        }
-
-      g_free (sum - length);
-      g_free (curve - length);
-    }
-
-  g_free (data);
-  g_free (buf);
-}
-
 static inline void
 rotate_pointers (guchar  **p,
                  guint32   n)
diff --git a/app/paint-funcs/paint-funcs.h b/app/paint-funcs/paint-funcs.h
index a343b98..24506e6 100644
--- a/app/paint-funcs/paint-funcs.h
+++ b/app/paint-funcs/paint-funcs.h
@@ -400,10 +400,6 @@ void  multiply_alpha_region               (PixelRegion *srcR);
 
 void  separate_alpha_region               (PixelRegion *srcR);
 
-void  gaussian_blur_region                (PixelRegion *srcR,
-                                           gdouble      radius_x,
-                                           gdouble      radius_y);
-
 void  border_region                       (PixelRegion *src,
                                            gint16       xradius,
                                            gint16       yradius,



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