[cairo] Re: fix pixel offsets in rotated image sources
spitzak at d2.com
Fri Sep 16 15:00:34 PDT 2005
Bertram Felgenhauer wrote:
> It's right that this works on the matrix level; note, however, that the
> translation by -.5, -.5 is only correct for bilinear filtering; for
> 'nearest' filtering you should leave that out, as I tried to explain
> in my previous mail.
I would think it works for "nearest" filtering as well. It certainly
works for the identity, 90 degree rotations, and integer scales, but I
can't test others. A "nearest" filter is a spike, while bilinear is a
triangle. Both are symmetric so I would think they would work the same.
> I wonder how many applications there are that rely on the current
> behaviour of Xrender like that, i.e. if it's safe to fix that in the Xserver.
I would suspect this would be a bad idea as it would break software that
is already compensating for it, such as my software and Cairo.
>>Note that 0x10000 is 1.0 in XRender matrix integers and >>1 is a
> cairo/pixman uses (IntToxFixed(1)) to get the appropriate value for 1.
> Note that >>1 is not guaranteed to work for negative integers.
Unfortunately /2 rounds toward zero, which is equally broken. This
produces visible artifacts such as 1-pixel shifts as arbitrary
calculations pass through zero. Shift rounds down always. I don't think
there are any machines powerful enough to run Cairo that do not do
signed shifts correctly.
More information about the cairo