Imprecise stroke position at large coordinates when playing back a scaled recording surface
Submitted by Zoltan Turanyi
Assigned to Chris Wilson @ickle
Description
Created attachment 122986 The code reproducing the error.
When I record a stroke and a show_text() at the same location to a recording surface, they show up at different locations during playback to an image surface if
- the coordinates of the elements are large (dont appear around zero, do appear around 20000)
- at certain scaling factors (not at integer scaling, but more pronounced at 1.6 or 1.87).
I attach a couple of images. They were created by the attached code. Essentially I record two items on a recording surface (a line and a piece of text) at the same vertical location (denoted by 'offset'). Then I play it back to an image surface using 'scale' scaling. Since I will be using large offsets I only replay the area around the two items. (The bug remains even if I replay the whole recording surface from (0,0) to the location items, but that would make comparison hard and images large.)
The first number in the image name is the scaling factor (*100), the second is the offset used.
The error seems to affect only the stroke, as you can see the text is always positioned at the middle of the viewport (as intended). However, the stroke is not drawn at the same location and the difference seems to depend on the offset and the scale. It seems to be linearly increasing by the offset and seems to vary somewhat randomly by the scale. For integer scales it does not appear. Overall I suspect this is some form of a rounding error, but could not figure this out even after some debugging.
Attachment 122986, "The code reproducing the error.":
CairoBug.c