[cairo] understanding scaling in _cairo_surface_fallback_fill actual drawing code

Carl Worth cworth at cworth.org
Mon Oct 13 10:32:21 PDT 2008


On Mon, 2008-10-13 at 16:02 +0530, Abhijit Bhopatkar wrote:
> I am trying to understand how cairo does scaling on the images.
...
> But tracing further down i could not find any function that does actual scaling 
> of the image data. Finally the calls end up doing XRenderComposite

You've traced it succesfully.

Cairo uses the X Render extension to pass the scaling matrix to the X
server. The X server can then, (if using EXA), pass that matrix to a
driver that has the option of configuring hardware-based scaling. Or, if
the driver/hardware don't support that, then the X server will fallback
to software and use the pixman library to perform the scaling.

Note also, that if you use cairo's image backend in the first place then
it will also call directly into pixman to do the image scaling.

Finally, you don't say *why* you're wanting to look at the image-scaling
code, but one long-term complaint with the software implementation in
pixman has been that scaling down by more than a factor of 2 has very
poor results, (with the default biliinear filter). Jeff Muizelaar
recently posted a new box-filter implementation for pixman that improves
this dramatically:
	http://lists.cairographics.org/archives/cairo/2008-October/015338.html

I hope that helps, and I hope you have fun with cairo!

-Carl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.cairographics.org/archives/cairo/attachments/20081013/c4657a1b/attachment.pgp 


More information about the cairo mailing list