Since cairo 1.14 the image filters changed a bit:
- CAIRO_FILTER_GOOD uses a box filter when downscaling if the scale factor is less than 0.75, otherwise it uses a filter equivalent to CAIRO_FILTER_BILINEAR.
- CAIRO_FILTER_BEST uses always a Catmull-Rom filter.
We are currently using CAIRO_FILTER_BILINEAR for medium, high and default interpolation levels. We could use CAIRO_FILTER_GOOD for medium and default, and CAIRO_FILTER_BEST for high. This will not have any effect in previous versions of cairo because before 1.14 CAIRO_FILTER_GOOD, CAIRO_FILTER_BILINEAR and CAIRO_FILTER_BEST had the same implementation in pixman.
Created attachment 258615 [details]
I took screenshots of MiniBrowser downscaling this image http://bighugelabs.com/flickr/onblack.php?id=4305303148&size=large before and after the patch. I'll submit them so you can see the differences.
Created attachment 258616 [details]
Created attachment 258617 [details]
This seems like a reasonable change, though I have some concerns about the performance implications. It'd probably best to match the Mac port as closely as possible here.
(In reply to comment #4)
> This seems like a reasonable change, though I have some concerns about the
> performance implications. It'd probably best to match the Mac port as
> closely as possible here.
I don't think there's much difference in terms of performance, GOOD only uses the box filter for downscaling, otherwise it does bilinear, so in most of the cases it will be the same, and the performance of the box filter is not that different to bilinear either. The difference will be when using BEST, because the Catmull-Rom filter will be definitely slower than bilinear, but it's only used for the High quality interpolation that is supposed to be used when the performance is not that important. WebCore already uses no interpolation (FAST which is NEAREST) when loading or scrolling, and after a timeout of staying in the same position, a better interpolation is used. I don't know exactly the details, though.
And regarding matching Mac, well, it's very difficult to match the performance of two different rendering libraries, in my opinion. But reading the documentation of CGInterpolationQuality this patch matches the definitions of the Medium and High values, I would say:
kCGInterpolationMedium: A medium level of interpolation quality. This setting is slower than the low setting but faster than the high setting.
kCGInterpolationHigh: A high level of interpolation quality. This setting may slow down image rendering.
Committed r188379: <http://trac.webkit.org/changeset/188379>
This caused a regression in wk4wl on Raspberry Pi, where layer flushes can take up to 3 seconds because of the time spent updating the tiled backing store. With a couple of flushes stringed together, a whole page can often freeze up for a longer period.
Comment on attachment 258615 [details]
View in context: https://bugs.webkit.org/attachment.cgi?id=258615&action=review
> + cairo_pattern_set_filter(pattern.get(), CAIRO_FILTER_GOOD);
> + case InterpolationHigh:
Here is the problem, I'm afraid . . . there's a break missing there, which means we are now using CAIRO_FILTER_BEST as default :-P