[gimp/goat-invasion] app: remove temp_buf_resize()



commit d8e7eecd07565aa859f8194118bb95c5f9a30c08
Author: Michael Natterer <mitch gimp org>
Date:   Sat Apr 7 23:58:38 2012 +0200

    app: remove temp_buf_resize()
    
    and fix its only user by simply reallocating the buf.

 app/base/temp-buf.c           |   35 -----------------------------------
 app/base/temp-buf.h           |    6 ------
 app/tools/gimpiscissorstool.c |    6 ++++--
 3 files changed, 4 insertions(+), 43 deletions(-)
---
diff --git a/app/base/temp-buf.c b/app/base/temp-buf.c
index 9eb1307..7e2d0af 100644
--- a/app/base/temp-buf.c
+++ b/app/base/temp-buf.c
@@ -105,41 +105,6 @@ temp_buf_copy (TempBuf *src,
 }
 
 TempBuf *
-temp_buf_resize (TempBuf *buf,
-                 gint     bytes,
-                 gint     x,
-                 gint     y,
-                 gint     width,
-                 gint     height)
-{
-  g_return_val_if_fail (width > 0 && height > 0, NULL);
-
-  if (! buf)
-    {
-      buf = temp_buf_new (width, height, bytes);
-      buf->x = x;
-      buf->y = y;
-    }
-  else
-    {
-      gsize size = width * height * bytes;
-
-      if (size != (buf->width * buf->height * buf->bytes))
-        {
-          buf->data = g_renew (guchar, buf->data, size);
-        }
-
-      buf->x      = x;
-      buf->y      = y;
-      buf->width  = width;
-      buf->height = height;
-      buf->bytes  = bytes;
-    }
-
-  return buf;
-}
-
-TempBuf *
 temp_buf_scale (TempBuf *src,
                 gint     new_width,
                 gint     new_height)
diff --git a/app/base/temp-buf.h b/app/base/temp-buf.h
index e0b785f..b12bae8 100644
--- a/app/base/temp-buf.h
+++ b/app/base/temp-buf.h
@@ -37,12 +37,6 @@ TempBuf * temp_buf_new           (gint           width,
                                   gint           bytes);
 TempBuf * temp_buf_copy          (TempBuf       *src,
                                   TempBuf       *dest);
-TempBuf * temp_buf_resize        (TempBuf       *buf,
-                                  gint           bytes,
-                                  gint           x,
-                                  gint           y,
-                                  gint           width,
-                                  gint           height);
 TempBuf * temp_buf_scale         (TempBuf       *buf,
                                   gint           width,
                                   gint           height) G_GNUC_WARN_UNUSED_RESULT;
diff --git a/app/tools/gimpiscissorstool.c b/app/tools/gimpiscissorstool.c
index bc0684f..8670a3f 100644
--- a/app/tools/gimpiscissorstool.c
+++ b/app/tools/gimpiscissorstool.c
@@ -1335,8 +1335,10 @@ calculate_curve (GimpIscissorsTool *iscissors,
           iscissors->gradient_map = gradient_map_new (image);
 
       /*  allocate the dynamic programming array  */
-      iscissors->dp_buf =
-        temp_buf_resize (iscissors->dp_buf, 4, x1, y1, width, height);
+      if (iscissors->dp_buf)
+        temp_buf_free (iscissors->dp_buf);
+
+      iscissors->dp_buf = temp_buf_new (width, height, 4);
 
       /*  find the optimal path of pixels from (x1, y1) to (x2, y2)  */
       find_optimal_path (iscissors->gradient_map, iscissors->dp_buf,



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