[cairo] Concerns about using filters for downscaling

Krzysztof Kosiński tweenk.pl at gmail.com
Fri Mar 21 19:24:57 PDT 2014

2014-03-21 23:33 GMT+01:00 Owen Taylor <otaylor at redhat.com>:
> Downsides with the general approach:
>  * The approach is not efficient for large downscales, especially
>    when transformed. Approaches involving:
>     - Sampling from a mipmap
>     - Sampling a sparse set of irregularly distributed points
>    will be more efficient.

Mipmapping would also help the case of drawing an image at e.g. 1/10
scale multiple times, which happens for example when interactively
resizing an image in Inkscape.

>  * On a hardware backend, running even a large convolution filter in
>    a shader is likely possible on current hardware, but it's not
>    taking efficient use of how hardware is designed to sample images.
> Here are my suggestions with an eye to getting a release of 1.14
> out quickly
>  * The convolution code is restricted to the BEST filter, leaving
>    GOOD and BILINEAR untouched for now. The goal in the future
>    is we'd try to get similar quality for all backends, whether by:
>     A) Triggering a fallback
>     B) Implementing convolution with the same filter
>     C) Using an entirely different technique with the similar
>        quality.

This would make Cairo 1.14 completely unusable for Inkscape, so we
would have to postpone the long overdue 0.91 release for another year
or more, and probably stop using Cairo. The downscaling method used in
1.12 is simply incorrect and due to severe visual artifacts makes it
impossible to use Inkscape to edit drawings that contain large
bitmaps, e.g. photos. It's no use being fast if the result is wrong.

Regards, Krzysztof

More information about the cairo mailing list