GNOME Bugzilla – Bug 606551
reflect & rotate increase buffer height/width
Last modified: 2018-05-22 12:04:43 UTC
Created attachment 151123 [details] Code to reproduce the bug The reflect and rotate operations increase the buffer's height and width by 2 and when saved as PNG and they are seen as 2 transparent rows and columns.
Just a reminder to ourselves: When we fix this we should not forget to add a regression test. This is typical bug that has a tendency to come back.
In current Git master, the extra pixels are black and not transparent.
From what I understood by reading the code: static void gegl_sampler_linear_init (GeglSamplerLinear *self) { GEGL_SAMPLER (self)->context_rect.x = 0; GEGL_SAMPLER (self)->context_rect.y = 0; GEGL_SAMPLER (self)->context_rect.width = 2; GEGL_SAMPLER (self)->context_rect.height = 2; GEGL_SAMPLER (self)->interpolate_format = babl_format ("RaGaBaA float"); } Now the sampler->context_rect.width and sampler->context_rect->height gets added to the result in gegl_affine_get_bounding_box and gegl_affine_get_required_for_output leading to the increase in the width and height by 2.
Confirmed, 3 black pixels are added to the image. Thanks for easy way to reproduce.
Whether the additional pixel data is black or transparent depends on whether the original buffer has an alpha component or not. This is perhaps only to be considered a valid bug for rotations of 90, 180 and 270 degrees, since additional pixels will be needed to compute correct antialiasing for other cases.
Confirmed, crop:rotate adds ~1px rows/columns for some angles (agreed, it seems that only happens for 90, 180, 270 degrees, sometimes). After applying changes suggested by comments on operations/transform-core.c (https://gist.github.com/automata/10b5d47a4db6a19f3554), borders went away. However, that broke some composition tests (e.g. colors, adding borders to each tile). Maybe something related with sub-pixel transform?
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gegl/issues/9.