[gimp] app: do not copy needlessly paint_mask GimpTempBuf.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: do not copy needlessly paint_mask GimpTempBuf.
- Date: Sat, 31 Mar 2018 14:56:43 +0000 (UTC)
commit 04a798d786617257ffa2b75ad24a14afd7b5c087
Author: Jehan <jehan girinstud io>
Date: Sat Mar 31 16:36:55 2018 +0200
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.
app/paint/gimppaintcore-loops.c | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/app/paint/gimppaintcore-loops.c b/app/paint/gimppaintcore-loops.c
index a58b3f3..b6b60fc 100644
--- a/app/paint/gimppaintcore-loops.c
+++ b/app/paint/gimppaintcore-loops.c
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]