[gimp] libgimpcolor: make gimp_color_transform_process_buffer() thread-safer
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpcolor: make gimp_color_transform_process_buffer() thread-safer
- Date: Thu, 2 Aug 2018 17:29:48 +0000 (UTC)
commit 3889a591970e7876145f80a061eb67554fe252b9
Author: Michael Natterer <mitch gimp org>
Date: Thu Aug 2 19:25:52 2018 +0200
libgimpcolor: make gimp_color_transform_process_buffer() thread-safer
Avoid gegl_buffer_set_format() and simply construct the formats
differently to make sure reading/writing doesn't do any color space
transform. This makes it possible again to run it on different areas
of the same buffer from different threads.
libgimpcolor/gimpcolortransform.c | 32 +++++++++++---------------------
1 file changed, 11 insertions(+), 21 deletions(-)
---
diff --git a/libgimpcolor/gimpcolortransform.c b/libgimpcolor/gimpcolortransform.c
index 35426f5708..2ddc0f6563 100644
--- a/libgimpcolor/gimpcolortransform.c
+++ b/libgimpcolor/gimpcolortransform.c
@@ -284,7 +284,7 @@ gimp_color_transform_new (GimpColorProfile *src_profile,
priv->transform = NULL;
}
- g_printerr ("%s\n", lcms_last_error);
+ g_printerr ("%s: %s\n", G_STRFUNC, lcms_last_error);
}
if (! priv->transform)
@@ -380,7 +380,7 @@ gimp_color_transform_new_proofing (GimpColorProfile *src_profile,
priv->transform = NULL;
}
- g_printerr ("%s\n", lcms_last_error);
+ g_printerr ("%s: %s\n", G_STRFUNC, lcms_last_error);
}
if (! priv->transform)
@@ -537,31 +537,28 @@ gimp_color_transform_process_buffer (GimpColorTransform *transform,
/* we must not do any babl color transforms when reading from
* src_buffer or writing to dest_buffer, so construct formats with
- * src_buffers's and dest_buffers's encoding, and the transform's
- * input and output color spaces.
+ * the transform's expected input and output encoding and
+ * src_buffer's and dest_buffers's color spaces.
*/
src_format = gegl_buffer_get_format (src_buffer);
dest_format = gegl_buffer_get_format (dest_buffer);
src_format =
- babl_format_with_space (babl_format_get_encoding (src_format),
- babl_format_get_space (priv->src_format));
+ babl_format_with_space (babl_format_get_encoding (priv->src_format),
+ babl_format_get_space (src_format));
dest_format =
- babl_format_with_space (babl_format_get_encoding (dest_format),
- babl_format_get_space (priv->dest_format));
+ babl_format_with_space (babl_format_get_encoding (priv->dest_format),
+ babl_format_get_space (dest_format));
if (src_buffer != dest_buffer)
{
- gegl_buffer_set_format (src_buffer, src_format);
- gegl_buffer_set_format (dest_buffer, dest_format);
-
iter = gegl_buffer_iterator_new (src_buffer, src_rect, 0,
- priv->src_format,
+ src_format,
GEGL_ACCESS_READ,
GEGL_ABYSS_NONE);
gegl_buffer_iterator_add (iter, dest_buffer, dest_rect, 0,
- priv->dest_format,
+ dest_format,
GEGL_ACCESS_WRITE,
GEGL_ABYSS_NONE);
@@ -584,16 +581,11 @@ gimp_color_transform_process_buffer (GimpColorTransform *transform,
(gdouble) done_pixels /
(gdouble) total_pixels);
}
-
- gegl_buffer_set_format (src_buffer, NULL);
- gegl_buffer_set_format (dest_buffer, NULL);
}
else
{
- gegl_buffer_set_format (src_buffer, src_format);
-
iter = gegl_buffer_iterator_new (src_buffer, src_rect, 0,
- priv->src_format,
+ src_format,
GEGL_ACCESS_READWRITE,
GEGL_ABYSS_NONE);
@@ -616,8 +608,6 @@ gimp_color_transform_process_buffer (GimpColorTransform *transform,
(gdouble) done_pixels /
(gdouble) total_pixels);
}
-
- gegl_buffer_set_format (src_buffer, NULL);
}
g_signal_emit (transform, gimp_color_transform_signals[PROGRESS], 0,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]