[cairo] Better quality downsampling in cairo/pixman

Owen Taylor otaylor at redhat.com
Fri Aug 13 11:00:10 PDT 2010


On Tue, 2010-06-29 at 10:04 +0300, Alexander Shulgin wrote:

> The other day I was using Alt+TAB to switch between windows in my
> brand new Ubuntu desktop and was unpleasantly surprised how window
> thumbnails quality was in striking contrast with the overall eye-candy
> of the desktop (other effects seem to use OpenGL).

I think pixman and cairo are pretty irrelevant for this. Window
downscaling for previews needs to:

 A) Leave the images in video memory
 B) Be fast and hardware accelerated

The basic way that GPU's sample images is bilinear sampling. As we see
with Cairo currently, that doesn't work nicely once you are scaling down
more than a factor of two. In a normal game, the way that things work is
that the game provides a version of the image with multiple level of
details (a mipmap) and the GPU picks the closest one to avoid large
amounts of scaling. Or there are extensions for automatic mipmap
generation.

Automatic mipmap generation doesn't really mix with the
"texture_from_pixmap" extension used for OpenGL compositors in X.
(Certainly not any of the free drivers), but it's possible to emulate
the effect with a bit of programming. I wrote code to do this for
Mutter, the GNOME 3 window manager. The effect isn't as good as you
could do with real high quality filtering, but it's vastly better than
what you are seeing.

- Owen




More information about the cairo mailing list