From 3eed20136808bf444f1bc2f0f02ef3b65931ec00 Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Tue, 1 Oct 2024 10:45:30 +0000 Subject: [PATCH] core: Scale filters with "output-extent" role Some filters such as gegl:spiral have properties which limit their width and height, separate from the gegl:crop nodes in GimpDrawableFilter. As a result, they won't scale when the layer or image is resized even if the crop is updated. This patch checks if there's a "width" or "height" property with the "output-extent" role in the filter, and updates those properties to make sure it resizes correctly. Renders made from selections are not modified, as the user specifically chose that size. --- app/core/gimpdrawablefilter.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/app/core/gimpdrawablefilter.c b/app/core/gimpdrawablefilter.c index 82c48448e9..3da4e79ddf 100644 --- a/app/core/gimpdrawablefilter.c +++ b/app/core/gimpdrawablefilter.c @@ -929,6 +929,36 @@ void gimp_drawable_filter_refresh_crop (GimpDrawableFilter *filter, if (rect) { + /* Some filters have built-in width/height properties that limit + * the buffer size. If they have one in those roles, we can update + * their size here. */ + GParamSpec *gegl_pspec_width = NULL; + GParamSpec *gegl_pspec_height = NULL; + + gegl_pspec_width = gegl_node_find_property (filter->operation, "width"); + gegl_pspec_height = gegl_node_find_property (filter->operation, "height"); + + if (gegl_pspec_width != NULL) + { + if (gimp_gegl_param_spec_has_key (gegl_pspec_width, + "role", + "output-extent")) + { + gegl_node_set (filter->operation, "width", rect->width, NULL); + filter->filter_area.width = rect->width; + } + } + if (gegl_pspec_height != NULL) + { + if (gimp_gegl_param_spec_has_key (gegl_pspec_height, + "role", + "output-extent")) + { + gegl_node_set (filter->operation, "height", rect->height, NULL); + filter->filter_area.height = rect->height; + } + } + gimp_drawable_filter_set_clip (filter, TRUE); gimp_drawable_filter_set_clip (filter, FALSE); gimp_drawable_filter_set_region (filter, GIMP_FILTER_REGION_SELECTION);