diff --git a/ChangeLog b/ChangeLog index 4ec95d5178c61e180fad3b57bf801df93a8bb68e..15d9bd64cdd8426def9203463c463d028f679e4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-09-03 Michael Natterer + + * app/base/temp-buf.c (temp_buf_resize): do new_size calculation + only when needed. + 2005-09-03 Michael Natterer * app/paint/gimppaintcore.c (gimp_paint_core_get_orig_image) diff --git a/app/base/temp-buf.c b/app/base/temp-buf.c index e957e2385728820ff93cf189fde038679483cbf6..0bea61e448e44911f0aec151ca6e40cf157cc5aa 100644 --- a/app/base/temp-buf.c +++ b/app/base/temp-buf.c @@ -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;