[gimp/blend-tool-fun: 142/163] app: add progress handling to gimp_gegl_convert_color_profile, transform()
- From: Michael Henning <mhenning src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/blend-tool-fun: 142/163] app: add progress handling to gimp_gegl_convert_color_profile, transform()
- Date: Mon, 26 Oct 2015 02:30:10 +0000 (UTC)
commit 4d3f84da70509ac1dad0e2f925dd9dd2ee8ffbdc
Author: Michael Natterer <mitch gimp org>
Date: Mon Oct 19 01:29:22 2015 +0200
app: add progress handling to gimp_gegl_convert_color_profile,transform()
app/core/gimplayer-new.c | 2 +-
app/core/gimplayer.c | 2 +-
app/gegl/gimp-gegl-loops.c | 35 ++++++++++++++++++++++++++++++++---
app/gegl/gimp-gegl-loops.h | 6 ++++--
app/widgets/gimpviewrenderer.c | 6 ++++--
5 files changed, 42 insertions(+), 9 deletions(-)
---
diff --git a/app/core/gimplayer-new.c b/app/core/gimplayer-new.c
index 99ea81b..6a9b838 100644
--- a/app/core/gimplayer-new.c
+++ b/app/core/gimplayer-new.c
@@ -252,5 +252,5 @@ gimp_layer_new_convert_buffer (GimpLayer *layer,
gimp_gegl_convert_color_profile (src_buffer, NULL, src_profile,
dest_buffer, NULL, dest_profile,
GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL,
- TRUE);
+ TRUE, NULL);
}
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index b901828..bf75049 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -1115,7 +1115,7 @@ gimp_layer_convert_type (GimpDrawable *drawable,
gimp_gegl_convert_color_profile (src_buffer, NULL, src_profile,
dest_buffer, NULL, dest_profile,
GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL,
- TRUE);
+ TRUE, NULL);
}
else
{
diff --git a/app/gegl/gimp-gegl-loops.c b/app/gegl/gimp-gegl-loops.c
index 239892d..47af27e 100644
--- a/app/gegl/gimp-gegl-loops.c
+++ b/app/gegl/gimp-gegl-loops.c
@@ -34,6 +34,8 @@
#include "gimp-babl.h"
#include "gimp-gegl-loops.h"
+#include "core/gimpprogress.h"
+
void
gimp_gegl_convolve (GeglBuffer *src_buffer,
@@ -695,7 +697,8 @@ gimp_gegl_convert_color_profile (GeglBuffer *src_buffer,
const GeglRectangle *dest_rect,
GimpColorProfile *dest_profile,
GimpColorRenderingIntent intent,
- gboolean bpc)
+ gboolean bpc,
+ GimpProgress *progress)
{
const Babl *src_format;
const Babl *dest_format;
@@ -737,7 +740,7 @@ gimp_gegl_convert_color_profile (GeglBuffer *src_buffer,
{
gimp_gegl_convert_color_transform (src_buffer, src_rect, src_format,
dest_buffer, dest_rect, dest_format,
- transform);
+ transform, progress);
cmsDeleteTransform (transform);
}
@@ -746,6 +749,9 @@ gimp_gegl_convert_color_profile (GeglBuffer *src_buffer,
/* FIXME: no idea if this ever happens */
gegl_buffer_copy (src_buffer, src_rect, GEGL_ABYSS_NONE,
dest_buffer, dest_rect);
+
+ if (progress)
+ gimp_progress_set_value (progress, 1.0);
}
}
@@ -756,10 +762,23 @@ gimp_gegl_convert_color_transform (GeglBuffer *src_buffer,
GeglBuffer *dest_buffer,
const GeglRectangle *dest_rect,
const Babl *dest_format,
- GimpColorTransform transform)
+ GimpColorTransform transform,
+ GimpProgress *progress)
{
GeglBufferIterator *iter;
gboolean has_alpha;
+ gint total_pixels;
+ gint done_pixels = 0;
+
+ if (src_rect)
+ {
+ total_pixels = src_rect->width * src_rect->height;
+ }
+ else
+ {
+ total_pixels = (gegl_buffer_get_width (src_buffer) *
+ gegl_buffer_get_height (src_buffer));
+ }
has_alpha = babl_format_has_alpha (dest_format);
@@ -787,5 +806,15 @@ gimp_gegl_convert_color_transform (GeglBuffer *src_buffer,
{
cmsDoTransform (transform,
iter->data[0], iter->data[1], iter->length);
+
+ done_pixels += iter->roi[0].width * iter->roi[0].height;
+
+ if (progress)
+ gimp_progress_set_value (progress,
+ (gdouble) done_pixels /
+ (gdouble) total_pixels);
}
+
+ if (progress)
+ gimp_progress_set_value (progress, 1.0);
}
diff --git a/app/gegl/gimp-gegl-loops.h b/app/gegl/gimp-gegl-loops.h
index 5a9a6bc..73747c8 100644
--- a/app/gegl/gimp-gegl-loops.h
+++ b/app/gegl/gimp-gegl-loops.h
@@ -95,7 +95,8 @@ void gimp_gegl_convert_color_profile (GeglBuffer *src_buffer,
const GeglRectangle *dest_rect,
GimpColorProfile *dest_profile,
GimpColorRenderingIntent intent,
- gboolean bpc);
+ gboolean bpc,
+ GimpProgress *progress);
void gimp_gegl_convert_color_transform
(GeglBuffer *src_buffer,
@@ -104,7 +105,8 @@ void gimp_gegl_convert_color_transform
GeglBuffer *dest_buffer,
const GeglRectangle *dest_rect,
const Babl *dest_format,
- GimpColorTransform transform);
+ GimpColorTransform transform,
+ GimpProgress *progress);
#endif /* __GIMP_GEGL_LOOPS_H__ */
diff --git a/app/widgets/gimpviewrenderer.c b/app/widgets/gimpviewrenderer.c
index 2536c86..5030111 100644
--- a/app/widgets/gimpviewrenderer.c
+++ b/app/widgets/gimpviewrenderer.c
@@ -1093,7 +1093,8 @@ gimp_view_render_temp_buf_to_surface (GimpViewRenderer *renderer,
dest_buffer,
GEGL_RECTANGLE (0, 0, 0, 0),
renderer->profile_dest_format,
- renderer->profile_transform);
+ renderer->profile_transform,
+ NULL);
}
else
{
@@ -1142,7 +1143,8 @@ gimp_view_render_temp_buf_to_surface (GimpViewRenderer *renderer,
dest_buffer,
GEGL_RECTANGLE (x, y, 0, 0),
renderer->profile_dest_format,
- renderer->profile_transform);
+ renderer->profile_transform,
+ NULL);
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]