Commit 874c832a authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

do new_size calculation only when needed.

2005-09-03  Michael Natterer  <mitch@gimp.org>

	* app/base/temp-buf.c (temp_buf_resize): do new_size calculation
	only when needed.
parent 8dcebeaa
2005-09-03 Michael Natterer <mitch@gimp.org>
* app/base/temp-buf.c (temp_buf_resize): do new_size calculation
only when needed.
2005-09-03 Michael Natterer <mitch@gimp.org>
* app/paint/gimppaintcore.c (gimp_paint_core_get_orig_image)
......
......@@ -317,26 +317,23 @@ temp_buf_resize (TempBuf *buf,
gint width,
gint height)
{
gint size;
g_return_val_if_fail (width > 0 && height > 0, NULL);
/* calculate the requested size */
size = width * height * bytes;
/* First, configure the canvas buffer */
if (!buf)
if (! buf)
{
buf = temp_buf_new (width, height, bytes, x, y, NULL);
}
else
{
if (size != (buf->width * buf->height * buf->bytes))
gint new_size;
new_size = width * height * bytes;
if (new_size != (buf->width * buf->height * buf->bytes))
{
buf->data = g_renew (guchar, buf->data, size);
buf->data = g_renew (guchar, buf->data, new_size);
}
/* Make sure the temp buf fields are valid */
buf->x = x;
buf->y = y;
buf->width = width;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment