[cairo] Supersampling - 1st attempt

Krzysztof Kosiński tweenk.pl at gmail.com
Tue Aug 10 19:23:59 PDT 2010


W dniu 11 sierpnia 2010 03:18 użytkownik Soeren Sandmann
<sandmann at daimi.au.dk> napisał:
>> 2. Shouldn't we use nearest-neighbor sampling to obtain subpixels?
>
> That's determined by what filter is being used in the call
> bits_fetch_pixel_filtered(). So if you call
>
>        pixman_image_set_filter()
>
> with FILTER_NEAREST, then the subpixel will be obtained through
> nearest-neighbor sampling. If you set it to LINEAR, then it will use
> bilinear interpolation.

My point is that maybe the filter should affect the way the pixels are
combined, not how the subpixel values are computed. If there are many
subpixels averaged together, it doesn't make a lot of sense to use an
expensive method of computing them - the cheapest one
(nearest-neighbor) might be sufficient.

> - As you mention in a comment, it would be faster to compute fractions
>  and then repeatedly add them. If this creates precision problems,
>  maybe we need to look into using floating point.

What is the policy on floating point use in Pixman right now? It seems
to use fixed point almost everywhere, even though this causes
rendering artifacts, for example this one:
https://bugs.freedesktop.org/show_bug.cgi?id=29470

Maybe floating point / fixed point use should be determined at build
time, so architectures with fast FPUs can get high precision while
integer-only architectures can trade precision for performance?

Regards, Krzysztof


More information about the cairo mailing list