app: remove temp_buf_resize()

and fix its only user by simply reallocating the buf.
This commit is contained in:
Michael Natterer
2012-04-07 23:58:38 +02:00
parent 8202dcb44e
commit d743bae6a7
3 changed files with 4 additions and 43 deletions

View File

@ -104,41 +104,6 @@ temp_buf_copy (TempBuf *src,
return dest;
}
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,

View File

@ -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;

View File

@ -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,