Commit 04a798d7 authored by Jehan's avatar Jehan

app: do not copy needlessly paint_mask GimpTempBuf.

We are not doing any write operation on this mask data so copying all
the data just to read it and unreffing it in the end is only a cost on
performance.
See also bug 694917.
parent 49285463
......@@ -47,12 +47,11 @@ combine_paint_mask_to_canvas_mask (const GimpTempBuf *paint_mask,
const gint mask_stride = gimp_temp_buf_get_width (paint_mask);
const gint mask_start_offset = mask_y_offset * mask_stride + mask_x_offset;
const Babl *mask_format = gimp_temp_buf_get_format (paint_mask);
GimpTempBuf *modified_mask = gimp_temp_buf_copy (paint_mask);
gint width;
gint height;
width = gimp_temp_buf_get_width (modified_mask);
height = gimp_temp_buf_get_height (modified_mask);
width = gimp_temp_buf_get_width (paint_mask);
height = gimp_temp_buf_get_height (paint_mask);
roi.x = x_offset;
roi.y = y_offset;
......@@ -67,7 +66,7 @@ combine_paint_mask_to_canvas_mask (const GimpTempBuf *paint_mask,
{
if (mask_format == babl_format ("Y u8"))
{
const guint8 *mask_data = (const guint8 *) gimp_temp_buf_get_data (modified_mask);
const guint8 *mask_data = (const guint8 *) gimp_temp_buf_get_data (paint_mask);
mask_data += mask_start_offset;
while (gegl_buffer_iterator_next (iter))
......@@ -92,7 +91,7 @@ combine_paint_mask_to_canvas_mask (const GimpTempBuf *paint_mask,
}
else if (mask_format == babl_format ("Y float"))
{
const gfloat *mask_data = (const gfloat *) gimp_temp_buf_get_data (modified_mask);
const gfloat *mask_data = (const gfloat *) gimp_temp_buf_get_data (paint_mask);
mask_data += mask_start_offset;
while (gegl_buffer_iterator_next (iter))
......@@ -124,7 +123,7 @@ combine_paint_mask_to_canvas_mask (const GimpTempBuf *paint_mask,
{
if (mask_format == babl_format ("Y u8"))
{
const guint8 *mask_data = (const guint8 *) gimp_temp_buf_get_data (modified_mask);
const guint8 *mask_data = (const guint8 *) gimp_temp_buf_get_data (paint_mask);
mask_data += mask_start_offset;
while (gegl_buffer_iterator_next (iter))
......@@ -150,7 +149,7 @@ combine_paint_mask_to_canvas_mask (const GimpTempBuf *paint_mask,
}
else if (mask_format == babl_format ("Y float"))
{
const gfloat *mask_data = (const gfloat *) gimp_temp_buf_get_data (modified_mask);
const gfloat *mask_data = (const gfloat *) gimp_temp_buf_get_data (paint_mask);
mask_data += mask_start_offset;
while (gegl_buffer_iterator_next (iter))
......@@ -179,7 +178,6 @@ combine_paint_mask_to_canvas_mask (const GimpTempBuf *paint_mask,
g_warning("Mask format not supported: %s", babl_get_name (mask_format));
}
}
gimp_temp_buf_unref (modified_mask);
}
void
......
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