[gimp] app: crop GimpDrawableFilter output
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: crop GimpDrawableFilter output
- Date: Wed, 25 Apr 2018 19:58:44 +0000 (UTC)
commit d6a7302678787833d8ab2e78c546d7f12120c51a
Author: Ell <ell_se yahoo com>
Date: Wed Apr 25 15:41:00 2018 -0400
app: crop GimpDrawableFilter output
Add a crop node to the GimpDrawableFilter graph, applied after the
filter's output, cropping the output to the filter area (the same
area used for the input crop node). If we fail to do this, filters
whose op's bounding box is bigger than the input region can affect
areas outside the drawable, when the filter is rendered as part of
the image graph (in contrast to being comitted). This is
particularly relevant to source ops, that may have an infinite
bounding box.
We probably didn't notice this until now, since before the recent
GimpProjection update-area changes, only the drawable's area would
get invalidated in response to changes in the filter, so regions
outside the drawable wouldn't normally get rendered. However, this
could still have been triggered by causing regions outside the
drawable to be invalidated by other means.
app/core/gimpdrawablefilter.c | 30 ++++++++++++++++++++++--------
1 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/app/core/gimpdrawablefilter.c b/app/core/gimpdrawablefilter.c
index 10e123f..26e80c5 100644
--- a/app/core/gimpdrawablefilter.c
+++ b/app/core/gimpdrawablefilter.c
@@ -77,11 +77,12 @@ struct _GimpDrawableFilter
GeglRectangle filter_area;
GeglNode *translate;
- GeglNode *crop;
+ GeglNode *crop_before;
GeglNode *cast_before;
GeglNode *transform_before;
GeglNode *transform_after;
GeglNode *cast_after;
+ GeglNode *crop_after;
GimpApplicator *applicator;
};
@@ -215,9 +216,9 @@ gimp_drawable_filter_new (GimpDrawable *drawable,
filter->translate = gegl_node_new_child (node,
"operation", "gegl:translate",
NULL);
- filter->crop = gegl_node_new_child (node,
- "operation", "gegl:crop",
- NULL);
+ filter->crop_before = gegl_node_new_child (node,
+ "operation", "gegl:crop",
+ NULL);
filter->cast_before = gegl_node_new_child (node,
"operation", "gegl:nop",
@@ -232,6 +233,10 @@ gimp_drawable_filter_new (GimpDrawable *drawable,
"operation", "gegl:nop",
NULL);
+ filter->crop_after = gegl_node_new_child (node,
+ "operation", "gegl:crop",
+ NULL);
+
input = gegl_node_get_input_proxy (node, "input");
if (gegl_node_has_pad (filter->operation, "input"))
@@ -250,15 +255,16 @@ gimp_drawable_filter_new (GimpDrawable *drawable,
gegl_node_link_many (input,
filter->translate,
- filter->crop,
+ filter->crop_before,
filter->cast_before,
filter->transform_before,
effect,
filter->transform_after,
filter->cast_after,
+ filter->crop_after,
NULL);
- gegl_node_connect_to (filter->cast_after, "output",
+ gegl_node_connect_to (filter->crop_after, "output",
node, "aux");
return filter;
@@ -454,7 +460,11 @@ gimp_drawable_filter_sync_region (GimpDrawableFilter *filter)
"y", (gdouble) -filter->filter_area.y,
NULL);
- gegl_node_set (filter->crop,
+ gegl_node_set (filter->crop_before,
+ "width", (gdouble) filter->filter_area.width,
+ "height", (gdouble) filter->filter_area.height,
+ NULL);
+ gegl_node_set (filter->crop_after,
"width", (gdouble) filter->filter_area.width,
"height", (gdouble) filter->filter_area.height,
NULL);
@@ -474,7 +484,11 @@ gimp_drawable_filter_sync_region (GimpDrawableFilter *filter)
"y", (gdouble) 0.0,
NULL);
- gegl_node_set (filter->crop,
+ gegl_node_set (filter->crop_before,
+ "width", width,
+ "height", height,
+ NULL);
+ gegl_node_set (filter->crop_after,
"width", width,
"height", height,
NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]