[cairo] Concerns about using filters for downscaling

Owen Taylor otaylor at redhat.com
Mon Mar 24 14:33:08 PDT 2014


On Sun, 2014-03-23 at 02:13 +0100, Krzysztof Kosiński wrote:I

> > The final approach approach would be to extend the filter enumeration
> > with a specific value for what you want Inkscape - maybe make
> > CAIRO_FILTER_BOX be the LINEAR/BOX combination. Main downsides are
> > figuring out what it would do on other backends. Trigger fallbacks?
> > And having to carry it going forward.
> 
> If you want to keep the performance, then CAIRO_FILTER_GOOD and
> CAIRO_FILTER_BEST should be deprecated, because they give wrong
> results (not matching their documentation), and new values e.g.
> CAIRO_FILTER_HIGH_QUALITY, CAIRO_FILTER_MEDIUM_QUALITY should be
> introduced. On other backends, they would do what GOOD and BEST do
> currently, because this is essentially a workaround for a bug in the
> image backend.

First, remember, that the image backend *is* the implementation behind a
lot of the other backends, significantly the win32 backend. (Which
is one reason I'm very wary about performance regressions.) Beyond that:

 Xlib/XCB backend - behaves exactly as the image backend used to.

 Quartz backend - GOOD/BEST are mapped onto kCGInterpolationDefault
   which seems to be bilinear sampling - see:
http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/

 GL backend - behaves pretty much exactly as the image backend used to.
 Auto-mipmapping could be enabled for some drivers.

I don't know what the Skia backend does offhand without digging into the
Skia sources. The OpenVG specification leaves it's behavior undefined. 

But that's really a bit irrelevant :-) The thing is, the current
definitions of GOOD and BEST are reasonably well thought out, and they
are loose enough we can certainly change what they do. We just can't
change them so they are slow as the code currently in Git makes them.
And we should have a plan for doing things consistently across backends.

(It would definitely be good to get more opinions on this thread - the
last time I was heavily working on Cairo was in 2005.)

- Owen




More information about the cairo mailing list