Skip to content

buffer: Fix handling of the bottom abyss edge for negative co-ordinates

Debarshi Ray requested to merge wip/rishi/buffer-set-abyss-bottom-negative into master

The bufy value is an offset relative to the beginning of the memory buffer. It indicates the number of rows that've already been written and the index of the next row. On the other hand, the abyss_y_total value is the absolute vertical co-ordinate that lies just beyond the bottom edge of the abyss. It's the sum of the top edge and height of the abyss. In short, they lie in two different co-ordinate spaces - one relative, the other absolute.

Therefore, bufy can only be used with abyss_y_total if the vertical co-ordinate of the top edge is used to normalize the spaces.

Consider writing to [(-160,-160) 640x640] that matches the extent and abyss of a GeglBuffer with 80x80 tiles. When bufy equals 480 at the beginning of the 480th row in the buffer, the target absolute co-ordinate in the buffer would be (0, 320) at the top left corner of the seventh row of tiles. The abyss_y_total of this buffer is also 480. Here, the existing calculation breaks down and the writes get truncated.

Fallout from 52e28c10

Merge request reports