[gimp] app: don't leak one TempBuf per blurred brush mask/pixmap
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: don't leak one TempBuf per blurred brush mask/pixmap
- Date: Wed, 4 Apr 2012 09:36:33 +0000 (UTC)
commit e1dcba190eac7ec5534e9ae745ff657b6d78a8d6
Author: Michael Natterer <mitch gimp org>
Date: Wed Apr 4 11:35:59 2012 +0200
app: don't leak one TempBuf per blurred brush mask/pixmap
app/core/gimpbrush-transform.c | 49 ++++++++++++++++++++++++---------------
1 files changed, 30 insertions(+), 19 deletions(-)
---
diff --git a/app/core/gimpbrush-transform.c b/app/core/gimpbrush-transform.c
index ff35d37..7cd5a44 100644
--- a/app/core/gimpbrush-transform.c
+++ b/app/core/gimpbrush-transform.c
@@ -328,16 +328,17 @@ gimp_brush_real_transform_mask (GimpBrush *brush,
if (hardness < 1.0)
{
- TempBuf *blur_src;
+ TempBuf *blur_src;
PixelRegion srcPR;
PixelRegion destPR;
- gint kernel_size = gimp_brush_transform_blur_kernel_size (result->height,
- result->width,
- hardness);
- gint kernel_len = kernel_size * kernel_size;
- gfloat blur_kernel [kernel_len];
+ gint kernel_size =
+ gimp_brush_transform_blur_kernel_size (result->height,
+ result->width,
+ hardness);
+ gint kernel_len = kernel_size * kernel_size;
+ gfloat blur_kernel[kernel_len];
- gimp_brush_transform_fill_blur_kernel ( blur_kernel, kernel_len);
+ gimp_brush_transform_fill_blur_kernel (blur_kernel, kernel_len);
blur_src = temp_buf_copy (result, NULL);
@@ -348,9 +349,12 @@ gimp_brush_real_transform_mask (GimpBrush *brush,
result->x, result->y,
result->width, result->height);
- convolve_region (&srcPR, &destPR, blur_kernel, kernel_size,
+ convolve_region (&srcPR, &destPR,
+ blur_kernel, kernel_size,
gimp_brush_transform_array_sum (blur_kernel, kernel_len),
GIMP_NORMAL_CONVOL, FALSE);
+
+ temp_buf_free (blur_src);
}
return result;
@@ -619,26 +623,33 @@ gimp_brush_real_transform_pixmap (GimpBrush *brush,
if (hardness < 1.0)
{
- TempBuf *blur_src;
+ TempBuf *blur_src;
PixelRegion srcPR;
PixelRegion destPR;
- gint kernel_size = gimp_brush_transform_blur_kernel_size ( result->height,
- result->width,
- hardness);
- gint kernel_len = kernel_size * kernel_size;
- gfloat blur_kernel [kernel_len];
+ gint kernel_size =
+ gimp_brush_transform_blur_kernel_size (result->height,
+ result->width,
+ hardness);
+ gint kernel_len = kernel_size * kernel_size;
+ gfloat blur_kernel[kernel_len];
- gimp_brush_transform_fill_blur_kernel ( blur_kernel, kernel_len);
+ gimp_brush_transform_fill_blur_kernel (blur_kernel, kernel_len);
blur_src = temp_buf_copy (result, NULL);
- pixel_region_init_temp_buf (&srcPR, blur_src, blur_src->x, blur_src->y, blur_src->width, blur_src->height);
- pixel_region_init_temp_buf (&destPR, result, result->x, result->y, result->width, result->height);
+ pixel_region_init_temp_buf (&srcPR, blur_src,
+ blur_src->x, blur_src->y,
+ blur_src->width, blur_src->height);
+ pixel_region_init_temp_buf (&destPR, result,
+ result->x, result->y,
+ result->width, result->height);
- convolve_region (&srcPR, &destPR, blur_kernel, kernel_size,
- gimp_brush_transform_array_sum(blur_kernel, kernel_len),
+ convolve_region (&srcPR, &destPR,
+ blur_kernel, kernel_size,
+ gimp_brush_transform_array_sum (blur_kernel, kernel_len),
GIMP_NORMAL_CONVOL, FALSE);
+ temp_buf_free (blur_src);
}
return result;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]