app: remove temp_buf_resize()
and fix its only user by simply reallocating the buf.
This commit is contained in:
@ -104,41 +104,6 @@ temp_buf_copy (TempBuf *src,
|
|||||||
return dest;
|
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 *
|
TempBuf *
|
||||||
temp_buf_scale (TempBuf *src,
|
temp_buf_scale (TempBuf *src,
|
||||||
gint new_width,
|
gint new_width,
|
||||||
|
@ -37,12 +37,6 @@ TempBuf * temp_buf_new (gint width,
|
|||||||
gint bytes);
|
gint bytes);
|
||||||
TempBuf * temp_buf_copy (TempBuf *src,
|
TempBuf * temp_buf_copy (TempBuf *src,
|
||||||
TempBuf *dest);
|
TempBuf *dest);
|
||||||
TempBuf * temp_buf_resize (TempBuf *buf,
|
|
||||||
gint bytes,
|
|
||||||
gint x,
|
|
||||||
gint y,
|
|
||||||
gint width,
|
|
||||||
gint height);
|
|
||||||
TempBuf * temp_buf_scale (TempBuf *buf,
|
TempBuf * temp_buf_scale (TempBuf *buf,
|
||||||
gint width,
|
gint width,
|
||||||
gint height) G_GNUC_WARN_UNUSED_RESULT;
|
gint height) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
@ -1335,8 +1335,10 @@ calculate_curve (GimpIscissorsTool *iscissors,
|
|||||||
iscissors->gradient_map = gradient_map_new (image);
|
iscissors->gradient_map = gradient_map_new (image);
|
||||||
|
|
||||||
/* allocate the dynamic programming array */
|
/* allocate the dynamic programming array */
|
||||||
iscissors->dp_buf =
|
if (iscissors->dp_buf)
|
||||||
temp_buf_resize (iscissors->dp_buf, 4, x1, y1, width, height);
|
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 the optimal path of pixels from (x1, y1) to (x2, y2) */
|
||||||
find_optimal_path (iscissors->gradient_map, iscissors->dp_buf,
|
find_optimal_path (iscissors->gradient_map, iscissors->dp_buf,
|
||||||
|
Reference in New Issue
Block a user