Commit 1bbd3d40 authored by Michael Natterer's avatar Michael Natterer 😴

app: make the GimpTempBuf struct private and add accessors

parent 3a46cfbb
......@@ -96,8 +96,8 @@ pixel_region_init_temp_buf (PixelRegion *PR,
PR->curtile = NULL;
PR->offx = 0;
PR->offy = 0;
PR->bytes = babl_format_get_bytes_per_pixel (temp_buf->format);
PR->rowstride = temp_buf->width * PR->bytes;
PR->bytes = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (temp_buf));
PR->rowstride = gimp_temp_buf_get_width (temp_buf) * PR->bytes;
PR->x = x;
PR->y = y;
PR->w = w;
......
......@@ -468,7 +468,7 @@ gimp_edit_fill_full (GimpImage *image,
return TRUE; /* nothing to do, but the fill succeded */
if (pattern &&
babl_format_has_alpha (pattern->mask->format) &&
babl_format_has_alpha (gimp_temp_buf_get_format (pattern->mask)) &&
! gimp_drawable_has_alpha (drawable))
{
format = gimp_drawable_get_format_with_alpha (drawable);
......
......@@ -67,7 +67,8 @@ gimp_brush_real_transform_size (GimpBrush *brush,
GimpMatrix3 matrix;
gint x, y;
gimp_brush_transform_matrix (brush->mask->width, brush->mask->height,
gimp_brush_transform_matrix (gimp_temp_buf_get_width (brush->mask),
gimp_temp_buf_get_height (brush->mask),
scale, aspect_ratio, angle, &matrix);
gimp_brush_transform_bounding_box (brush->mask, &matrix, &x, &y, width, height);
......@@ -173,14 +174,15 @@ gimp_brush_real_transform_mask (GimpBrush *brush,
source = brush->mask;
gimp_brush_transform_matrix (source->height, source->width,
src_width = gimp_temp_buf_get_width (source);
src_height = gimp_temp_buf_get_height (source);
gimp_brush_transform_matrix (src_width, src_height,
scale, aspect_ratio, angle, &matrix);
if (gimp_matrix3_is_identity (&matrix))
return gimp_temp_buf_copy (source);
src_width = source->width;
src_height = source->height;
src_width_minus_one = src_width - 1;
src_height_minus_one = src_height - 1;
......@@ -190,7 +192,7 @@ gimp_brush_real_transform_mask (GimpBrush *brush,
gimp_matrix3_invert (&matrix);
result = gimp_temp_buf_new (dest_width, dest_height,
brush->mask->format);
gimp_temp_buf_get_format (brush->mask));
dest = gimp_temp_buf_get_data (result);
src = gimp_temp_buf_get_data (source);
......@@ -332,9 +334,9 @@ gimp_brush_real_transform_mask (GimpBrush *brush,
GeglBuffer *src_buffer;
GeglBuffer *dest_buffer;
gint kernel_size =
gimp_brush_transform_blur_kernel_size (result->height,
result->width,
hardness);
gimp_brush_transform_blur_kernel_size (gimp_temp_buf_get_height (result),
gimp_temp_buf_get_width (result),
hardness);
gint kernel_len = kernel_size * kernel_size;
gfloat blur_kernel[kernel_len];
......@@ -349,12 +351,12 @@ gimp_brush_real_transform_mask (GimpBrush *brush,
gimp_gegl_convolve (src_buffer,
GEGL_RECTANGLE (0, 0,
blur_src->width,
blur_src->height),
gimp_temp_buf_get_width (blur_src),
gimp_temp_buf_get_height (blur_src)),
dest_buffer,
GEGL_RECTANGLE (0, 0,
result->width,
result->height),
gimp_temp_buf_get_width (result),
gimp_temp_buf_get_height (result)),
blur_kernel, kernel_size,
gimp_brush_transform_array_sum (blur_kernel,
kernel_len),
......@@ -471,14 +473,15 @@ gimp_brush_real_transform_pixmap (GimpBrush *brush,
source = brush->pixmap;
gimp_brush_transform_matrix (source->height, source->width,
src_width = gimp_temp_buf_get_width (source);
src_height = gimp_temp_buf_get_height (source);
gimp_brush_transform_matrix (src_width, src_height,
scale, aspect_ratio, angle, &matrix);
if (gimp_matrix3_is_identity (&matrix))
return gimp_temp_buf_copy (source);
src_width = source->width;
src_height = source->height;
src_width_minus_one = src_width - 1;
src_height_minus_one = src_height - 1;
......@@ -488,7 +491,7 @@ gimp_brush_real_transform_pixmap (GimpBrush *brush,
gimp_matrix3_invert (&matrix);
result = gimp_temp_buf_new (dest_width, dest_height,
brush->pixmap->format);
gimp_temp_buf_get_format (brush->pixmap));
dest = gimp_temp_buf_get_data (result);
src = gimp_temp_buf_get_data (source);
......@@ -635,9 +638,9 @@ gimp_brush_real_transform_pixmap (GimpBrush *brush,
GeglBuffer *src_buffer;
GeglBuffer *dest_buffer;
gint kernel_size =
gimp_brush_transform_blur_kernel_size (result->height,
result->width,
hardness);
gimp_brush_transform_blur_kernel_size (gimp_temp_buf_get_height (result),
gimp_temp_buf_get_width (result),
hardness);
gint kernel_len = kernel_size * kernel_size;
gfloat blur_kernel[kernel_len];
......@@ -652,12 +655,12 @@ gimp_brush_real_transform_pixmap (GimpBrush *brush,
gimp_gegl_convolve (src_buffer,
GEGL_RECTANGLE (0, 0,
blur_src->width,
blur_src->height),
gimp_temp_buf_get_width (blur_src),
gimp_temp_buf_get_height (blur_src)),
dest_buffer,
GEGL_RECTANGLE (0, 0,
result->width,
result->height),
gimp_temp_buf_get_width (result),
gimp_temp_buf_get_height (result)),
blur_kernel, kernel_size,
gimp_brush_transform_array_sum (blur_kernel,
kernel_len),
......@@ -712,8 +715,8 @@ gimp_brush_transform_bounding_box (GimpTempBuf *brush,
gint *width,
gint *height)
{
const gdouble w = brush->width;
const gdouble h = brush->height;
const gdouble w = gimp_temp_buf_get_width (brush);
const gdouble h = gimp_temp_buf_get_height (brush);
gdouble x1, x2, x3, x4;
gdouble y1, y2, y3, y4;
gdouble temp_x;
......
......@@ -268,8 +268,8 @@ gimp_brush_get_size (GimpViewable *viewable,
{
GimpBrush *brush = GIMP_BRUSH (viewable);
*width = brush->mask->width;
*height = brush->mask->height;
*width = gimp_temp_buf_get_width (brush->mask);
*height = gimp_temp_buf_get_height (brush->mask);
return TRUE;
}
......@@ -294,8 +294,8 @@ gimp_brush_get_new_preview (GimpViewable *viewable,
mask_buf = brush->mask;
pixmap_buf = brush->pixmap;
mask_width = mask_buf->width;
mask_height = mask_buf->height;
mask_width = gimp_temp_buf_get_width (mask_buf);
mask_height = gimp_temp_buf_get_height (mask_buf);
if (mask_width > width || mask_height > height)
{
......@@ -324,8 +324,8 @@ gimp_brush_get_new_preview (GimpViewable *viewable,
pixmap_buf = gimp_brush_transform_pixmap (brush, scale,
0.0, 0.0, 1.0);
mask_width = mask_buf->width;
mask_height = mask_buf->height;
mask_width = gimp_temp_buf_get_width (mask_buf);
mask_height = gimp_temp_buf_get_height (mask_buf);
scaled = TRUE;
}
......@@ -385,8 +385,8 @@ gimp_brush_get_description (GimpViewable *viewable,
return g_strdup_printf ("%s (%d × %d)",
gimp_object_get_name (brush),
brush->mask->width,
brush->mask->height);
gimp_temp_buf_get_width (brush->mask),
gimp_temp_buf_get_height (brush->mask));
}
static void
......@@ -581,8 +581,8 @@ gimp_brush_transform_size (GimpBrush *brush,
aspect_ratio == 0.0 &&
((angle == 0.0) || (angle == 0.5) || (angle == 1.0)))
{
*width = brush->mask->width;
*height = brush->mask->height;
*width = gimp_temp_buf_get_width (brush->mask);
*height = gimp_temp_buf_get_height (brush->mask);;
return;
}
......
......@@ -470,6 +470,7 @@ gimp_brush_generated_calc (GimpBrushGenerated *brush,
GimpVector2 x_axis;
GimpVector2 y_axis;
GimpTempBuf *mask;
gint mask_width;
gimp_brush_generated_get_half_size (brush,
shape,
......@@ -485,8 +486,10 @@ gimp_brush_generated_calc (GimpBrushGenerated *brush,
half_height * 2 + 1,
babl_format ("Y u8"));
mask_width = gimp_temp_buf_get_width (mask);
centerp = gimp_temp_buf_get_data (mask) +
half_height * mask->width + half_width;
half_height * mask_width + half_width;
lookup = gimp_brush_generated_calc_lut (radius, hardness);
......@@ -538,10 +541,10 @@ gimp_brush_generated_calc (GimpBrushGenerated *brush,
else
a = 0;
centerp[y * mask->width + x] = a;
centerp[y * mask_width + x] = a;
if (spikes % 2 == 0)
centerp[-1 * y * mask->width - x] = a;
centerp[-1 * y * mask_width - x] = a;
}
}
......
......@@ -101,9 +101,9 @@ gimp_image_get_preview (GimpViewable *viewable,
{
GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (viewable);
if (private->preview &&
private->preview->width == width &&
private->preview->height == height)
if (private->preview &&
gimp_temp_buf_get_width (private->preview) == width &&
gimp_temp_buf_get_height (private->preview) == height)
{
/* The easy way */
return private->preview;
......@@ -148,13 +148,15 @@ gimp_image_get_new_preview (GimpViewable *viewable,
if (is_premult)
{
if (buf->format == babl_format ("Y'A u8"))
const Babl *format = gimp_temp_buf_get_format (buf);
if (format == babl_format ("Y'A u8"))
{
buf->format = babl_format ("Y'aA u8");
gimp_temp_buf_set_format (buf, babl_format ("Y'aA u8"));
}
else if (buf->format == babl_format ("R'G'B'A u8"))
else if (format == babl_format ("R'G'B'A u8"))
{
buf->format = babl_format ("R'aG'aB'aA u8");
gimp_temp_buf_set_format (buf, babl_format ("R'aG'aB'aA u8"));
}
else
{
......
......@@ -131,8 +131,8 @@ gimp_pattern_get_size (GimpViewable *viewable,
{
GimpPattern *pattern = GIMP_PATTERN (viewable);
*width = pattern->mask->width;
*height = pattern->mask->height;
*width = gimp_temp_buf_get_width (pattern->mask);
*height = gimp_temp_buf_get_height (pattern->mask);
return TRUE;
}
......@@ -150,11 +150,11 @@ gimp_pattern_get_new_preview (GimpViewable *viewable,
gint copy_width;
gint copy_height;
copy_width = MIN (width, pattern->mask->width);
copy_height = MIN (height, pattern->mask->height);
copy_width = MIN (width, gimp_temp_buf_get_width (pattern->mask));
copy_height = MIN (height, gimp_temp_buf_get_height (pattern->mask));
temp_buf = gimp_temp_buf_new (copy_width, copy_height,
pattern->mask->format);
gimp_temp_buf_get_format (pattern->mask));
src_buffer = gimp_temp_buf_create_buffer (pattern->mask);
dest_buffer = gimp_temp_buf_create_buffer (temp_buf);
......@@ -176,8 +176,8 @@ gimp_pattern_get_description (GimpViewable *viewable,
return g_strdup_printf ("%s (%d × %d)",
gimp_object_get_name (pattern),
pattern->mask->width,
pattern->mask->height);
gimp_temp_buf_get_width (pattern->mask),
gimp_temp_buf_get_height (pattern->mask));
}
static const gchar *
......@@ -236,8 +236,8 @@ gimp_pattern_new (GimpContext *context,
data = gimp_temp_buf_get_data (pattern->mask);
for (row = 0; row < pattern->mask->height; row++)
for (col = 0; col < pattern->mask->width; col++)
for (row = 0; row < gimp_temp_buf_get_height (pattern->mask); row++)
for (col = 0; col < gimp_temp_buf_get_width (pattern->mask); col++)
{
memset (data, (col % 2) && (row % 2) ? 255 : 0, 3);
data += 3;
......
......@@ -43,7 +43,8 @@ preview_cache_compare (gconstpointer a,
const GimpTempBuf *buf1 = a;
const GimpTempBuf *buf2 = b;
if (buf1->width > buf2->width && buf1->height > buf2->height)
if (gimp_temp_buf_get_width (buf1) > gimp_temp_buf_get_width (buf2) &&
gimp_temp_buf_get_height (buf1) > gimp_temp_buf_get_height (buf2))
return -1;
return 1;
......@@ -59,7 +60,8 @@ preview_cache_find_exact (gpointer data,
if (nearest->buf)
return;
if (buf->width == nearest->width && buf->height == nearest->height)
if (gimp_temp_buf_get_width (buf) == nearest->width &&
gimp_temp_buf_get_height (buf) == nearest->height)
{
nearest->buf = buf;
return;
......@@ -73,15 +75,16 @@ preview_cache_find_biggest (gpointer data,
GimpTempBuf *buf = data;
PreviewNearest *nearest = udata;
if (buf->width >= nearest->width && buf->height >= nearest->height)
if (gimp_temp_buf_get_width (buf) >= nearest->width &&
gimp_temp_buf_get_height (buf) >= nearest->height)
{
/* Ok we could make the preview out of this one...
* If we already have it are these bigger dimensions?
*/
if (nearest->buf)
{
if (nearest->buf->width > buf->width &&
nearest->buf->height > buf->height)
if (gimp_temp_buf_get_width (nearest->buf) > gimp_temp_buf_get_width (buf) &&
gimp_temp_buf_get_height (nearest->buf) > gimp_temp_buf_get_height (buf))
return;
}
......@@ -109,7 +112,8 @@ preview_cache_remove_smallest (GSList **plist)
{
GimpTempBuf *this = list->data;
if (smallest->height * smallest->width > this->height * this->width)
if (gimp_temp_buf_get_width (smallest) * gimp_temp_buf_get_height (smallest) >
gimp_temp_buf_get_width (this) * gimp_temp_buf_get_height (this))
{
smallest = this;
}
......@@ -224,11 +228,12 @@ gimp_preview_cache_get (GSList **plist,
#endif
/* Make up new preview from the large one... */
pwidth = pn.buf->width;
pheight = pn.buf->height;
pwidth = gimp_temp_buf_get_width (pn.buf);
pheight = gimp_temp_buf_get_height (pn.buf);
/* Now get the real one and add to cache */
preview = gimp_temp_buf_new (width, height, pn.buf->format);
preview = gimp_temp_buf_new (width, height,
gimp_temp_buf_get_format (pn.buf));
/* preview from nearest bigger one */
if (width)
......@@ -244,7 +249,7 @@ gimp_preview_cache_get (GSList **plist,
src_data = gimp_temp_buf_get_data (pn.buf);
dest_data = gimp_temp_buf_get_data (preview);
bytes = babl_format_get_bytes_per_pixel (preview->format);
bytes = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (preview));
for (loop1 = 0 ; loop1 < height ; loop1++)
for (loop2 = 0 ; loop2 < width ; loop2++)
......
......@@ -28,6 +28,16 @@
#include "gimptempbuf.h"
struct _GimpTempBuf
{
gint ref_count;
gint width;
gint height;
const Babl *format;
guchar *data;
};
GimpTempBuf *
gimp_temp_buf_new (gint width,
gint height,
......@@ -41,13 +51,12 @@ gimp_temp_buf_new (gint width,
temp = g_slice_new (GimpTempBuf);
temp->ref_count = 1;
temp->format = format;
temp->width = width;
temp->height = height;
temp->data = g_new (guchar,
width * height *
babl_format_get_bytes_per_pixel (format));
temp->format = format;
temp->data = g_new (guchar,
width * height *
babl_format_get_bytes_per_pixel (format));
return temp;
}
......@@ -150,6 +159,34 @@ gimp_temp_buf_scale (const GimpTempBuf *src,
return dest;
}
gint
gimp_temp_buf_get_width (const GimpTempBuf *buf)
{
return buf->width;
}
gint
gimp_temp_buf_get_height (const GimpTempBuf *buf)
{
return buf->height;
}
const Babl *
gimp_temp_buf_get_format (const GimpTempBuf *buf)
{
return buf->format;
}
void
gimp_temp_buf_set_format (GimpTempBuf *buf,
const Babl *format)
{
g_return_if_fail (babl_format_get_bytes_per_pixel (buf->format) ==
babl_format_get_bytes_per_pixel (format));
buf->format = format;
}
guchar *
gimp_temp_buf_get_data (const GimpTempBuf *buf)
{
......
......@@ -19,16 +19,6 @@
#define __GIMP_TEMP_BUF_H__
struct _GimpTempBuf
{
gint ref_count;
const Babl *format;
gint width;
gint height;
guchar *data;
};
GimpTempBuf * gimp_temp_buf_new (gint width,
gint height,
const Babl *fomat) G_GNUC_WARN_UNUSED_RESULT;
......@@ -41,8 +31,16 @@ GimpTempBuf * gimp_temp_buf_scale (const GimpTempBuf *buf,
gint width,
gint height) G_GNUC_WARN_UNUSED_RESULT;
gint gimp_temp_buf_get_width (const GimpTempBuf *buf);
gint gimp_temp_buf_get_height (const GimpTempBuf *buf);
const Babl * gimp_temp_buf_get_format (const GimpTempBuf *buf);
void gimp_temp_buf_set_format (GimpTempBuf *buf,
const Babl *format);
guchar * gimp_temp_buf_get_data (const GimpTempBuf *buf);
gsize gimp_temp_buf_get_data_size (const GimpTempBuf *buf);
guchar * gimp_temp_buf_data_clear (GimpTempBuf *buf);
gsize gimp_temp_buf_get_memsize (const GimpTempBuf *buf);
......
......@@ -288,10 +288,11 @@ gimp_undo_get_popup_size (GimpViewable *viewable,
GimpUndo *undo = GIMP_UNDO (viewable);
if (undo->preview &&
(undo->preview->width > width || undo->preview->height > height))
(gimp_temp_buf_get_width (undo->preview) > width ||
gimp_temp_buf_get_height (undo->preview) > height))
{
*popup_width = undo->preview->width;
*popup_height = undo->preview->height;
*popup_width = gimp_temp_buf_get_width (undo->preview);
*popup_height = gimp_temp_buf_get_height (undo->preview);
return TRUE;
}
......@@ -312,8 +313,8 @@ gimp_undo_get_new_preview (GimpViewable *viewable,
gint preview_width;
gint preview_height;
gimp_viewable_calc_preview_size (undo->preview->width,
undo->preview->height,
gimp_viewable_calc_preview_size (gimp_temp_buf_get_width (undo->preview),
gimp_temp_buf_get_height (undo->preview),
width,
height,
TRUE, 1.0, 1.0,
......@@ -321,8 +322,8 @@ gimp_undo_get_new_preview (GimpViewable *viewable,
&preview_height,
NULL);
if (preview_width < undo->preview->width &&
preview_height < undo->preview->height)
if (preview_width < gimp_temp_buf_get_width (undo->preview) &&
preview_height < gimp_temp_buf_get_height (undo->preview))
{
return gimp_temp_buf_scale (undo->preview,
preview_width, preview_height);
......
......@@ -358,10 +358,10 @@ gimp_viewable_real_get_new_pixbuf (GimpViewable *viewable,
GeglBuffer *dest_buffer;
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
babl_format_has_alpha (temp_buf->format),
babl_format_has_alpha (gimp_temp_buf_get_format (temp_buf)),
8,
temp_buf->width,
temp_buf->height);
gimp_temp_buf_get_width (temp_buf),
gimp_temp_buf_get_height (temp_buf));
src_buffer = gimp_temp_buf_create_buffer (temp_buf);
dest_buffer = gimp_pixbuf_create_buffer (pixbuf);
......@@ -709,8 +709,8 @@ gimp_viewable_get_preview (GimpViewable *viewable,
if (private->preview_temp_buf)
{
if (private->preview_temp_buf->width == width &&
private->preview_temp_buf->height == height)
if (gimp_temp_buf_get_width (private->preview_temp_buf) == width &&
gimp_temp_buf_get_height (private->preview_temp_buf) == height)
{
return private->preview_temp_buf;
}
......
......@@ -332,8 +332,8 @@ gimp_brush_core_pre_paint (GimpPaintCore *paint_core,
paint_core->pixel_dist);
scale = paint_options->brush_size /
MAX (core->main_brush->mask->width,
core->main_brush->mask->height) *
MAX (gimp_temp_buf_get_width (core->main_brush->mask),
gimp_temp_buf_get_height (core->main_brush->mask)) *
gimp_dynamics_output_get_linear_value (size_output,
&current_coords,
paint_options,
......@@ -942,8 +942,8 @@ gimp_brush_core_paste_canvas (GimpBrushCore *core,
gint off_x;
gint off_y;
x = (gint) floor (coords->x) - (brush_mask->width >> 1);
y = (gint) floor (coords->y) - (brush_mask->height >> 1);
x = (gint) floor (coords->x) - (gimp_temp_buf_get_width (brush_mask) >> 1);
y = (gint) floor (coords->y) - (gimp_temp_buf_get_height (brush_mask) >> 1);
off_x = (x < 0) ? -x : 0;
off_y = (y < 0) ? -y : 0;
......@@ -992,8 +992,8 @@ gimp_brush_core_replace_canvas (GimpBrushCore *core,
gint off_x;
gint off_y;
x = (gint) floor (coords->x) - (brush_mask->width >> 1);
y = (gint) floor (coords->y) - (brush_mask->height >> 1);
x = (gint) floor (coords->x) - (gimp_temp_buf_get_width (brush_mask) >> 1);
y = (gint) floor (coords->y) - (gimp_temp_buf_get_height (brush_mask) >> 1);
off_x = (x < 0) ? -x : 0;
off_y = (y < 0) ? -y : 0;
......@@ -1066,21 +1066,25 @@ gimp_brush_core_subsample_mask (GimpBrushCore *core,
gint r, s;
gulong *accum[KERNEL_HEIGHT];
gint offs;
gint mask_width = gimp_temp_buf_get_width (mask);
gint mask_height = gimp_temp_buf_get_height (mask);
gint dest_width;
gint dest_height;
while (x < 0)
x += mask->width;
x += mask_width;
left = x - floor (x);
index1 = (gint) (left * (gdouble) (KERNEL_SUBSAMPLE + 1));
while (y < 0)
y += mask->height;
y += mask_height;
left = y - floor (y);
index2 = (gint) (left * (gdouble) (KERNEL_SUBSAMPLE + 1));
if ((mask->width % 2) == 0)
if ((mask_width % 2) == 0)
{
index1 += KERNEL_SUBSAMPLE >> 1;
......@@ -1091,7 +1095,7 @@ gimp_brush_core_subsample_mask (GimpBrushCore *core,
}
}
if ((mask->height % 2) == 0)
if ((mask_height % 2) == 0)
{
index2 += KERNEL_SUBSAMPLE >> 1;
......@@ -1125,21 +1129,24 @@ gimp_brush_core_subsample_mask (GimpBrushCore *core,
core->subsample_cache_invalid = FALSE;
}
dest = gimp_temp_buf_new (mask->width + 2,
mask->height + 2,
mask->format);
dest = gimp_temp_buf_new (mask_width + 2,
mask_height + 2,
gimp_temp_buf_get_format (mask));
gimp_temp_buf_data_clear (dest);
dest_width = gimp_temp_buf_get_width (dest);
dest_height = gimp_temp_buf_get_height (dest);
/* Allocate and initialize the accum buffer */
for (i = 0; i < KERNEL_HEIGHT ; i++)
accum[i] = g_new0 (gulong, dest->width + 1);
accum[i] = g_new0 (gulong, dest_width + 1);
core->subsample_brushes[index2][index1] = dest;
m = gimp_temp_buf_get_data (mask);
for (i = 0; i < mask->height; i++)
for (i = 0; i < mask_height; i++)
{
for (j = 0; j < mask->width; j++)
for (j = 0; j < mask_width; j++)
{
k = kernel;
for (r = 0; r < KERNEL_HEIGHT; r++)
......@@ -1153,20 +1160,20 @@ gimp_brush_core_subsample_mask (GimpBrushCore *core,
}
/* store the accum buffer into the destination mask */
d = gimp_temp_buf_get_data (dest) + (i + dest_offset_y) * dest->width;
for (j = 0; j < dest->width; j++)
d = gimp_temp_buf_get_data (dest) + (i + dest_offset_y) * dest_width;
for (j = 0; j < dest_width; j++)
*d++ = (accum[0][j] + 127) / KERNEL_SUM;
rotate_pointers (accum, KERNEL_HEIGHT);
memset (accum[KERNEL_HEIGHT - 1], 0, sizeof (gulong) * dest->width);
memset (accum[KERNEL_HEIGHT - 1], 0, sizeof (gulong) * dest_width);
}
/* store the rest of the accum buffer into the dest mask */
while (i + dest_offset_y < dest->height)
while (i + dest_offset_y < dest_height)
{
d = gimp_temp_buf_get_data (dest) + (i + dest_offset_y) * dest->width;
for (j = 0; j < dest->width; j++)
d = gimp_temp_buf_get_data (dest) + (i + dest_offset_y) * dest_width;
for (j = 0; j < dest_width; j++)
*d++ = (accum[0][j] + (KERNEL_SUM / 2)) / KERNEL_SUM;
rotate_pointers (accum, KERNEL_HEIGHT);
......@@ -1206,9 +1213,10 @@ gimp_brush_core_pressurize_mask (GimpBrushCore *core,
if (core->pressure_brush)
gimp_temp_buf_unref (core->pressure_brush);
core->pressure_brush = gimp_temp_buf_new (brush_mask->width + 2,