[gimp/gimp-2-10] app: add support for offset buffers in gimp_gegl_apply_[cached_]operation()
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: add support for offset buffers in gimp_gegl_apply_[cached_]operation()
- Date: Wed, 29 May 2019 09:39:23 +0000 (UTC)
commit 92bec259ac426ea70f8e6007a01742c020e8a49a
Author: Ell <ell_se yahoo com>
Date: Wed May 29 05:35:30 2019 -0400
app: add support for offset buffers in gimp_gegl_apply_[cached_]operation()
In gimp_gegl_apply_[cached_]operation(), add support for output
buffers whose extent's top-left corner is not (0, 0). This is
needed by the previous commit.
(cherry picked from commit a6393e6c5518f6b563b9179d6f5c76b07d2822a2)
app/gegl/gimp-gegl-apply-operation.c | 26 +++++++++-----------------
1 file changed, 9 insertions(+), 17 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-apply-operation.c b/app/gegl/gimp-gegl-apply-operation.c
index 2c8d35521f..ad838cd41e 100644
--- a/app/gegl/gimp-gegl-apply-operation.c
+++ b/app/gegl/gimp-gegl-apply-operation.c
@@ -84,7 +84,6 @@ gimp_gegl_apply_cached_operation (GeglBuffer *src_buffer,
GeglNode *operation_src_node = NULL;
GimpChunkIterator *iter;
cairo_region_t *region;
- GeglRectangle rect = { 0, };
gboolean progress_started = FALSE;
gboolean cancel = FALSE;
gint all_pixels;
@@ -98,15 +97,8 @@ gimp_gegl_apply_cached_operation (GeglBuffer *src_buffer,
g_return_val_if_fail (valid_rects == NULL || cache != NULL, FALSE);
g_return_val_if_fail (valid_rects == NULL || n_valid_rects != 0, FALSE);
- if (dest_rect)
- {
- rect = *dest_rect;
- }
- else
- {
- rect = *GEGL_RECTANGLE (0, 0, gegl_buffer_get_width (dest_buffer),
- gegl_buffer_get_height (dest_buffer));
- }
+ if (! dest_rect)
+ dest_rect = gegl_buffer_get_extent (dest_buffer);
gegl = gegl_node_new ();
@@ -151,10 +143,10 @@ gimp_gegl_apply_cached_operation (GeglBuffer *src_buffer,
crop_node = gegl_node_new_child (gegl,
"operation", "gegl:crop",
- "x", (gdouble) rect.x,
- "y", (gdouble) rect.y,
- "width", (gdouble) rect.width,
- "height", (gdouble) rect.height,
+ "x", (gdouble) dest_rect->x,
+ "y", (gdouble) dest_rect->y,
+ "width", (gdouble) dest_rect->width,
+ "height", (gdouble) dest_rect->height,
NULL);
gegl_node_connect_to (src_node, "output",
@@ -216,10 +208,10 @@ gimp_gegl_apply_cached_operation (GeglBuffer *src_buffer,
gegl_buffer_freeze_changed (dest_buffer);
- all_pixels = rect.width * rect.height;
+ all_pixels = dest_rect->width * dest_rect->height;
done_pixels = 0;
- region = cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rect);
+ region = cairo_region_create_rectangle ((cairo_rectangle_int_t *) dest_rect);
if (cache)
{
@@ -230,7 +222,7 @@ gimp_gegl_apply_cached_operation (GeglBuffer *src_buffer,
GeglRectangle valid_rect;
if (! gegl_rectangle_intersect (&valid_rect,
- &valid_rects[i], &rect))
+ &valid_rects[i], dest_rect))
{
continue;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]