app: copy the buffer rather than using it as source.

I think the previous code should be OK, but I had some criticals when
painting with a paint tool in the area which got extended:

> (gimp:577203): GLib-GObject-CRITICAL **: 21:37:08.402: value "-31" of type 'gint' is invalid or out of range for property 'y' of type 'gint'

It looks like there lingering pieces from the negative offset in the
buffer, which is probably a bug in GEGL?
Anyway let's go the shorter route for now, which is to copy the buffer
with a different offset. I don't think it's less efficient either
anyway.
This commit is contained in:
Jehan 2026-02-28 21:52:10 +01:00
parent 4c15be6a56
commit 3a53e4743e

View file

@ -1041,11 +1041,13 @@ gimp_drawable_real_set_buffer (GimpDrawable *drawable,
* This may happen for instance when merging filters which may
* render in negative coordinates.
*/
buffer = g_object_new (GEGL_TYPE_BUFFER,
"source", buffer,
"shift-x", extent->x,
"shift-y", extent->y,
NULL);
GeglBuffer *buffer2;
GeglRectangle extent2 = { 0, 0, extent->width, extent->height };
buffer2 = gegl_buffer_new (&extent2, gegl_buffer_get_format (buffer));
gimp_gegl_buffer_copy (buffer, extent, GEGL_ABYSS_NONE, buffer2, &extent2);
buffer = buffer2;
free_buffer = TRUE;
}